Code:-
int incomingByte = 0;
const int led=13;
void setup()
{
Serial.begin(9600);
pinMode(led,OUTPUT);
digitalWrite(led,LOW);
while (!Serial)
{
;
}
}
void loop()
{
if (Serial.available() > 0)
{
incomingByte = Serial.read();
}
if(incomingByte=='A')
{
digitalWrite(led,HIGH);
}
else if(incomingByte=='B')
{
digitalWrite(led,LOW);
}
}
Comments
Post a Comment