Go Down

Topic: My UNO broken? Can not on and off LED (Read 230 times) previous topic - next topic

creativen

I suspect my Arduino UNO broken, but I do not it is true broken or any else. My pin 13 (which contain build in led) always ON
And after I upload this code:
Code: [Select]
void setup()
{
Serial.begin(9600);
digitalWrite (13,LOW);
}



void loop()
{
while (Serial.available()==0);

int val = Serial.read () - '0';

if (val ==1)
{
  Serial.println("Led is On");
  digitalWrite(13,HIGH);
}
else if (val == 0)
{
Serial.println("Led is off");
digitalWrite(13,LOW);
}
else
{
Serial.println("Invalid");
}
}


then I open serial monitor,
i input 0, then it displays "Led is off", but the led is not turned off

WHAT HAPPEN TO MY ARDUINO?? ANY HELP PLEASE...

LarryD

The way you have it in your schematic isn't the same as how you have it wired up!

PeterH


I suspect my Arduino UNO broken, but I do not it is true broken or any else.


The bug in your sketch has already been pointed out.

In future, if you are concerned that you may have broken your Arduino, take off any hardware you may have connected to it and upload an example sketch such as 'blink'.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up