Hello, I'm just got my Arduino and am having trouble with some basic operations. I saw a similar post so I think it's going to be in this section.
My main goal is to try and send an integer from the Windows Form Application to the Arduino and to run a simple loop to show it is receiving. I've been looking at some other online resources,
http://forum.arduino.cc/index.php?topic=39873.0
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
serialPort1.Write("Run");
}
private void Blinker_ValueChanged(object sender, EventArgs e)
{
int Blinks = Convert.ToInt32(Math.Round(Blinker.Value)); //Convert the double from NumericUpDown into an int
}
}
}
void loop()
{
if (Serial.available())
{
running = Serial.readString();
if (running == "Run") //Check to see if Run is pressed
{
// if(Serial.available())
// {
// Blinks = Serial1.read;
for (int x; x = Blinks; x++) //Blink the LED the integer received number of times
{
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
// }
}
}
Since the Serial Port seems to write Strings, I'm not sure how to send the integer Blinks to the Arduino. The other post was talking about sending an integer between Arduino so I assume it should be possible to send an integer to the Arduino