int led = 13;
byte pinState = 0;
int myData = 0;
void setup()
{
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop()
{
{
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(2000); // for two seconds
}
if(Serial.available() > 0){
myData = Serial.read();
if(myData == '1')
digitalWrite(led, HIGH); //if '1' is pressed on computer LED on Arduino Uno board will light
}
}
I don't see how that would work with our without the shield, because in the first part of loop you are turning the LED on and off anyway (whether or not you have serial input).
{
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(2000); // for two seconds
}
What are these curly braces here for?
You have to decide under what conditions the LED should flash and under what conditions it should be on solid.
Personally, I'd use two different LEDs - one flashing to indicate that the system is working and one to indicate that it received a 1 from the serial port.
You might also want to consider some way to turn the LED off again.
The coding issues have nothing to do with the XBee or shield being in place or not.