hi im new at this, im looking for help....... because im stuck in this, basically what i need to do is send from labview a serial message to the arduino and turn On and Off LEDS, i have already made it work but just sending one character for example
data = serial.read()
if (data =="d") {
digitalWrite( 8, HIGH)
}
now what im trying to do .. is send a whole string of characters and compare it like this for example :
String readString;
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600
for (int var=2; var<=8; ++var)
{
pinMode(var,OUTPUT);
}
for (int var2=9; var2<=13; ++var2){
pinMode(var2,INPUT);
}
}
void loop() {
while (Serial.available()) {
delay(100);
if (Serial.available() >0) {
char c = Serial.read();
readString = c;
}
if(readString=="1000000"){
digitalWrite(2, HIGH);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
}
my problem is that is not working,i dont know how to get the whole string from the serial and compare it
please really need to understand why i cant make it work , ill be glad if someone helps me