Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending data from myrio to arduino UNO

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!

0 Kudos
Message 1 of 2
(2,887 Views)

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

0 Kudos
Message 2 of 2
(2,825 Views)