Hello
I am trying to send an integer array to arduino. The integer values varries from 0 to 255. I tried many ways and nothing seems to work. can you please help. i was trying to convert the integer value to byte array and then send it but for a reason, the method did not work.
this is the c# code
int[] values = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
string[] bytes = new string[20];
byte pwm;
for (int i = 0; i < 20; i++)
{
pwm = Convert.ToByte(value[i]);
data[0] = pwm;
serialPort1.Write(data, 0, 1);
}
and this is the arduino code
byte Csharp;
int value[20];
...
for(int i = 0;i<20;i++){
Csharp= Serial.read();
value[i] = int(Csharp);
}