Arduino reads only the first serial , how can i let it reads the whole serials?![]()
as shown here it only reads and light the first one which is in pin 7 and it does not response at all to what in pin 8
i send data from labview
void setup() {
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
Serial.begin(9600);
}
void loop()
{
int val = Serial.read();
int val2 = Serial.read();
if (val == '1')
digitalWrite(7,HIGH);
else if (val == '2')
digitalWrite(7,LOW);
if (val2 == '3')
digitalWrite(8,HIGH);
else if (val2 == '4')
digitalWrite(8,LOW);
}

