char LED;
void setup() {
Serial.begin(9600);
// initialize digital pin LED_BUILTIN as an output.
pinMode(13, OUTPUT);
Serial.print("please enter 1 to Trun the LED ON :\n");
Serial.print("please enter 0 Trun the LED OFF \n");
}
// the loop function runs over and over again forever
void loop() {
if (Serial.available()>0)
{
LED= Serial.read();
if (LED=='1')
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
Serial.print("LED ON \n");
}
else if (LED=='0')
{
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
Serial.print("LED OFF\n");
}
else if (LED== '\n' || LED== '\r') {
// Do nothing if the incoming serial is newline (\n) or carriage return (\r), which are automatically attached to the message when the serial monitor is in New Line or Carriage Return mode
} else {
Serial.println("Invalid input"); // Show message "Invalid input" in serial monitor when a message that's not '1' or '0' is sent to Arduino
}
}
}
/*
char input;
void setup() {
// put your setup code here, to run once:
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available())
{
input = Serial.read();
}
if(input == '1')
{
digitalWrite(13, 1);
}
else if(input == '0')
{
digitalWrite(13, 0);
}
}
*/
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
led1:A
led1:C
r1:1
r1:2