Hi all,
Trying to build an interface with some buttons to communicate with a micro. No joy. Win10, VS17, Arduino 1.8.5. Eventually going to be run on a Win7 tablet. I can successfully sent commands in the Serial Monitor, but C# will not open the comm port (COM5 in this case) and do the same. If I leave the Serial monitor open in Arduino, the C# complains, so I know it is trying, but I can't see why it isn't completing the link.
The scheme is one connected to the tablet talking to 20 or so coming in and out of range using RFM69's. All the functions work if I'm using "command line" in the Serial monitor, but I'm trying to automate it and make it a bit more operator proof.
I realize this is not specifically a Teensy question, but I wonder if anyone has run into a similar issue.
Sure would be nice to build a front end to manage these.
Thanks
bo
Trying to build an interface with some buttons to communicate with a micro. No joy. Win10, VS17, Arduino 1.8.5. Eventually going to be run on a Win7 tablet. I can successfully sent commands in the Serial Monitor, but C# will not open the comm port (COM5 in this case) and do the same. If I leave the Serial monitor open in Arduino, the C# complains, so I know it is trying, but I can't see why it isn't completing the link.
The scheme is one connected to the tablet talking to 20 or so coming in and out of range using RFM69's. All the functions work if I'm using "command line" in the Serial monitor, but I'm trying to automate it and make it a bit more operator proof.
I realize this is not specifically a Teensy question, but I wonder if anyone has run into a similar issue.
Sure would be nice to build a front end to manage these.
Code:
public partial class Form1 : Form {
SerialPort port; public Form1()
{
InitializeComponent();
this.FormClosed += new FormClosedEventHandler(Form1_FormClosed);
if (port == null)
{
//Change the portname according to your computer
port = new SerialPort("COM5", 9600);
port.Open();
}
}void Form1_FormClosed(object sender, FormClosedEventArgs e) {
if (port != null && port.IsOpen)
{
port.Close();
}
}private void button1_Click(object sender, EventArgs e) {
PortWrite("1");
}
private void button2_Click(object sender, EventArgs e)
{
PortWrite("0");
}private void PortWrite(string message) {
if (port != null && port.IsOpen)
{
port.Write(message);
}
}
}
Thanks
bo