I'm having trouble reading serial commands that I send with my computer using serial.
this is the arduino code.
if (Serial.available() > 6)
Serial.readBytesUntil('/', buffer, 120);
int v = Serial.read(); //green
int w = Serial.read();//red
int x = Serial.read(); //green
int y = Serial.read();//red
int z = Serial.read();//blue
int q = Serial.read();//blue
here is the c# code that sends the data
public void serialwrite()
slider1 = BitConverter.GetBytes(trackBar4.Value);
slider2 = BitConverter.GetBytes(trackBar5.Value);
slider3 = BitConverter.GetBytes(trackBar6.Value);
slider4 = BitConverter.GetBytes(trackBar7.Value);
slider5 = BitConverter.GetBytes(trackBar8.Value);
slider6 = BitConverter.GetBytes(trackBar9.Value);
serialPort1.Write(slider1, 0, 1);
serialPort1.Write(slider2, 0, 1);
serialPort1.Write(slider3, 0, 1);
serialPort1.Write(slider4, 0, 1);
serialPort1.Write(slider5, 0, 1);
serialPort1.Write(slider6, 0, 1);
Any help that you could provide would be greatly appreciated.
I'm looking to get the arduino to recieve a value from the trackbar between 0-255 and then set those value to the leds. The problem i have is that an led will randomly turn on and then off quickly.