Hey Guys,
I am pretty new to C#.
Below is some code that i am using to send data serially to an Arduino controller. It just has some push buttons which move the wheels/motors etc of an RC car i have. I have put some text boxes onto the form and want to let any numbers put in the boxes to be sent to the controller in the same way im sending the button press information.
Im a bit of a n00b and dont know how to do it.
Do i nest the text box data inside a button loop or something
any help would be appreciated. Thanks
Michael D
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
namespace ArduinoController
{
public partial class Form1 : Form
{
SerialPort port;
public Form1()
{
InitializeComponent();
port = new SerialPort("COM3", 9600, Parity.None, 8, StopBits.One);
port.Open();
}
private void button1_Click(object sender, EventArgs e)
{
port.Write("i"); //Value 105 sent serially to Arduino
}
private void button2_Click(object sender, EventArgs e)
{
port.Write("o"); //Value 111 sent serially to Arduino
}
private void button3_Click(object sender, EventArgs e)
{
port.Write("p"); //Value 112 sent serially to Arduino
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
??????????????
}
}
}