Hi, I’m new to both C# and RIOS. I’m doing a final year project in college that requires me to use the Wiimote to control a Lynxmotion arm. I’m just getting into it at the moment with easy programs. I’m trying to write a program; in C#; that uses two push buttons to rotate the shoulder servo. Unfortunately, I haven’t a clue how to do it.
This is my code at the moment:
public Form1()
{
InitializeComponent();
SerialPort serialPort1 = new SerialPort();
serialPort1.BaudRate = 115200;
serialPort1.PortName = "COM1";
serialPort1.Parity = Parity.None;
serialPort1.DataBits = 8;
serialPort1.StopBits = StopBits.One;
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void shoulderLeft_Click(object sender, EventArgs e)
{
// Write a string
serialPort1.WriteLine("#0 P1500 S750");
}
private void shoulderRight_Click(object sender, EventArgs e)
{
// Write a string
serialPort1.WriteLine("#0 P1600 S750");
}
private void closePort_Click(object sender, EventArgs e)
{
serialPort1.Close();
}
private void openPort_Click(object sender, EventArgs e)
{
// Open the port for communications
serialPort1.Open();
}
}
I know that I am missing something from the serial comms but I don’t know what, but I’m hoping someone here does.
Thanks for any help.