Hello there,
I would like to know if there is a way to send 8 bytes with c# to the serial port and also if it will read them immediately?
The code I was thinking about goes like this in the c#:
for(int i=0;i<8;i++)
myport.Write(buffer.ToString());
/// my serial port = myport
so would the next command will work for receiving in my serial port the whole 8 bytes?:
char data[8] = Serial.readBytes():
I would like to know either if can I blink few leds in the same time for about 2 seconds without coding them in the same place for example:
this is what I don't want to happen:
loop()
{
digitalWrite(13,HIGH);
digitalWrite(10,HIGH);
delay(2000);
digitalWrite(13,LOW);
digitalWrite(10,LOW);
delay(2000);
}
So in the example above 2 leds will blink simultaneously but it's not good for me this way!!
Im using 8 bits after all so I have 256 different options (each bit of the 8 represent a led) and I have an array in my c# program which represent '1' or '0' as 8 bits in the array for example array[8]={1,0,0,1,0,1,1,1,0};
So those '1' and '0' values change randomaly and I want the leds which each number value represent 1 of them to blink twice for 2 sec ON 2 sec OFF if their value is '1' and they will blink 7 times for 100 mili seconds if their value is '0'!!
loop()
{
digitalWrite(13,HIGH);
delay(2000);
digitalWrite(13,LOW);
delay(2000);
digitalWrite(10,HIGH);
delay(100);
digitalWrite(10,LOW);
delay(100);
}
the form above doesn't makes the leds to blink together and I have no idea how to make it to happen if it even posibble...
In other words - the delay is interrupting the synchronization between the blinking leds so I can't figure out how to blink them in the same time the way I would like them to blink as I mentioned before.
Writing a configuration for each form is too long (255 options after all) and it is not effective at all!!
Please help me and I hope you will understand my needs because they are too difficult to explain and I couldn't find a solution by myself....