Project 2 Error Fixed!!

Hey guys! I have found a way for your code to work!!

Please follow these steps for it to work:

  1. Make sure your Driver is installed on your computer. (If it isnt, Install it!)
  2. Use this code: int switchState = 0; //configures the digital pins void setup(){ pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); pinMode(2,INPUT); }

//Checks the voltageo of the digital input and chooses the pin for voltage ( pin 2 ) void loop(){ switchState = digitalRead(2);

if(switchState == LOW){ //Button is not pressed

digitalWrite(3,HIGH); //Green LED digitalWrite(4,LOW); //Red LED digitalWrite(5,LOW); //red LED }

else { //the button is pressed digitalWrite(3,LOW); digitalWrite(4,LOW); digitalWrite(5,HIGH);

delay(250); //wait for a quarter second //toggle the LEDs digitalWrite(4,HIGH); digitalWrite(5,LOW); delay(250); //wait for a quarter second } } //go back to the beginning of the loop

Boom! Your done!

Have fun with the Fixed code! Hope you followed the steps correctly! (I mean it..)

-AndrewTheCoder

I am an Expert Coder

. . . but you couldn't find your earlier post, or read the stickies?

Earlier more-or-less duplicate posts at end of an old topic are deleted, as I can't merge them with IE11.

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. Using code tags and other important information is explained in the How to use this forum post. Please read it.

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.