i was working on a simple light system as i'm a beginner and my arduino was working just fine till i made a system consist of 4 LEDs and i wrote my code and then i plugged my arduino to the laptop for applying the code and then i found that it's not working but when i took a closer look it was working but the same as it's connected to almost dead battery it's lighted but very week , thought it was the led which is dead but when connected it directly to the 5v and ground pins it was shining perfectly SO WHERE IS THE PROBLEM
is the problem with the pins ?? and if yes can i change them or my arduino won't work normally again !!!!
int blue1=8;
int red1=9;
int blue2=10;
int red2=11;
void setup() {
pinMode(blue1,OUTPUT);
pinMode(red1,OUTPUT);
pinMode(blue2,OUTPUT);
pinMode(red2,OUTPUT);
}
void loop() {
digitalWrite(blue1,HIGH);
digitalWrite(blue1,LOW);
delay(3000);
digitalWrite(red1,HIGH);
digitalWrite(red1,LOW);
delay(2000);
digitalWrite(blue2,HIGH);
digitalWrite(blue2,LOW);
delay(4000);
digitalWrite(red2,HIGH);
digitalWrite(red2,LOW);
delay(3000);
}
and here's the code which i was working on but still i have no idea what happened
Please post your full sketch. If possible you should always post code directly in the forum thread as text using code tags (</> button on the toolbar). This will make it easy for anyone to look at it, which will increase the likelihood of you getting help. If the sketch is longer than the forum will allow then it's OK to add it as an attachment. Don't put your code in some external file service like dropbox, etc. We shouldn't need to go to an external website just to help you. I do feel it's reasonable to post a link to code hosted on GitHub or similar code hosting sites since that's an platform specifically designed for this sort of thing
Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you're using the Arduino Web Editor then you will not have access to this useful tool. I recommend using the standard Arduino IDE instead.
by "led" i meant LED but i forgot the caps lock it's my bad and i wasn't using any resistors for the LEDs but that wasn't the problem i can insert some images to make you understand what i'm facing please if you can help me understanding what happened to my ARDUINO UNO it will be so much kindness from you <3
i will edit the post now and attach those images
And after fixing the code, there is a good chance that OP blows up the Arduino or the leds (not sure what will give in first) because there are no resistors in series with the leds.
finally i figured it out it was from the laptop ports as in my laptop one of the ports wasn't supplying the arduino with the entire load it needs thanks for your time i really appreciate what you done for me
and it seems that you have great experience with robotics and i would need your advice i took a basic course and i finished it but i still think that i'm soooo limited and i need more things to do but i don't knowhow and from where should start
caesar11:
i took a basic course and i finished it but i still think that i'm soooo limited and i need more things to do but i don't knowhow and from where should start
Listen to what experienced people here are trying to get through to you might be a good start.