03-15-2018 05:03 PM - edited 03-15-2018 05:04 PM
Hi everyone!
I'm trying to send data via Serial communication to my arduino Uno. The labview code is in the attached image.The arduino code is the following:
void setup(){ Serial.begin(9600); } void loop(){ data=Serial.Read(); if(data==1) digitalWrite(12,HIGH); }
Myrio and arduino uno GND are connected together.TX myrio pin is connected to RX arduino Uno pin and the RX myrio pin to TX arduino Uno pin.
Now my problem is that i send a string from myrio(i send character "1") and not a number, how arduino Uno code expects.
From ASCII table the character "1" is 49 in decimal.So in the arduino code should I put the number 49?
The labview code is right?
Thanks to everyone!
03-21-2018 11:18 AM
Hi,
let's clarify a little bit this communication. You transmit and receive a sequence of bit, for instance 00110001. in both writing and reading, you can interpret that sequence of bit in multiple way:
00110001 is 49 if you interpret as decimal
00110001 is "1" if you interpret as string
looking your image, you're writing a string.
I don't know how you're reading the data but it's only a matter of casting the data in the correct format