send seiral data from labview to my Arduino Uno

Hello All,

I have a very simple code (please see below) that should light up a led when I send 5 to the serial read from labview. Labview sends chars, and I only found that there is Serial.prarseInt how do I make the arduino to responde to labview chars?

When using the arduino serial screen everything works perfetct.

Thank Gil,

int d; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(8,OUTPUT); }

void loop() { if ( Serial.available() > 0 ) d=Serial.parseInt(); Serial.println(d); if (d==5) { digitalWrite(8,HIGH); } else { digitalWrite(8,LOW); } }

In Labview, are you sending the character '5' or the binary number 5?

Pete

The char '5'

Try

if (d=='5')

tried that, but since Serial.parseInt expects integer I get a compile error.
Pherhaps there is an another way for doing that?

Thanks,

GIl,

tried that, but since Serial.parseInt expects integer I get a compile error.

What? The parseInt() method expects some ASCII data coming in the serial port. It does "expect integer".