How can i receive the data from my Arduino Mega 2560 with Visual C# on my PC.
I send a short databyte (2 bytes) and a timestamp (4 bytes) over USB to PC
//initialization
const int RX = 0;
const int TX = 1;
void setup(){
pinMode(RX, INPUT); //readpin for USB
pinMode(TX, OUTPUT); //writepin for USB
...
Serial.begin(28800); //open interface
}
//loop()
Serial.print(incomingByte, BIN); //sending databyte
sendBinary(currentMillis); //send timestamp
//method for timestamp
void sendBinary(long currnetMillis)
{
int temp = currentMillis&0xFFFF; //16 bit of the low-byte
sendBinary(temp);
temp = currentMillis >> 16; //16 bit of the high-byte
sendBinary(temp);
}
I have surched in the internet for an example but i didn´t find a good. So i ask here what ist the best way with Visual Studio C# to receive the incoming data? An example code will be nice because i´m a beginner and didn´t understand the jargon.
With frindly wishes sniffi