Spaceship Interface Setup not working

I have an arduino uno setup the exact way as the projects guide book, as well as the same code. However, when I run the code, no lights show up. I also noticed that when I did circuits, the project would sometimes work, but not for others. Is something wrong with my arduino or is the project setup wrong?

OK, a few problems here.

The photo is useless, not focused and curiously, back-to-front - mirror inverted. Wondering in fact, how you did that?

You have not cut and pasted the code from the IDE that you are actually using, and posted it in "code" tags (using the little "scroll" icon above the submission window).

I don't have this book, nor do most people here and you have not even cited which one it is, so it would be difficult to advise anyway.

We have no idea what you mean by "the project would sometimes work, but not for others" because we do not know which worked, which did not and in what manner it did not work.

You might just as well ask us why your refrigerator is not working, with the same information supplied. :smiley:

My arduino works with the simple circuit, but when I follow the guide for series and parallel circuits, they don't work. With the spaceship interface, I followed the guide, which you can find here. Arduino Starter Kit Multi-language — Arduino Official Store By the way, I am referring to the 170 Page projects guide by Arduino.

Here is the 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

Ok, well we are getting somewhere. The photos are still entirely useless so we cannot tell whether your wiring is correct. (What are you using for a camera? If it is a webcam, some have a focus ring on the front. If a proper camera, you need to take the picture outside, perhaps on the balcony, in daylight, with the camera at least a metre and a half away using full zoom)

The code looks OK to me - button not pressed, shows green light, button pressed, gives alternate red flashes ("Railway Crossing" lights). And - checked it, it works for me. :smiley:

Again, you need to explain what you mean by "the simple circuit" and "the guide for series and parallel circuits" as well as "don't work".

The fact is, many of us who frequently answer, have never looked at the Arduino projects guide, so it is not assumed knowledge. :smiley:

Ok. So I realised based on various tests, that there is nothing wrong with the setup or programming, but the fact that the push buttons provided by Arduino are not connecting properly. Everything else does... Any ideas as what to do?

Hi, have you got the LEDs the right way round?
Have you got a DMM to help you with measuring voltages and testing diodes and LEDs?

It looks like you are using the analog I/O as your input/output. Use the line of pins on the other edge of the PCB that have 0 to 13 numbered and try again.
This because they are th I/O pins you are assigning in your input output statements.

Tom...... :slight_smile:

Hi Guys. I have been tinkering with my arduino uno, when I realised that the push buttons don't connect to the breadboard properly. However, other stuff connect, such as jumper wires, LEDS etc. The switches being used are from the Official Arduino Starter Kit. I believe that it is because the leads of the 4-pin buttons are not connecting to the breadboard properly as they are so short. Also, when I move it around, sometimes with will work for a split second...Any Ideas? These are almost like the same buttons here...

http://www.amazon.com/Ardokit-200pcs-Momentary-Tactile-Switch/dp/B00K5OO5VQ

Straighten the pins with a pair of pliers.

Hi, try this, pull the tactile switches out and turn them 1/4 turn and plug them back in.
Do you have a DMM to do some measurements?
For example check which pins on the switches are which, 4 pins only one normally open contact.
The pins are in pairs, one pair one side of switch and the other pair the other side of switch.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf?

Tom....... :slight_smile:

Still didn't work... Any other ideas to increase the flow of electricity?

Post a picture of the ones you actually have, with and without the pins being straightened, and then a picture of how you have it in the board.

Here are better pics

Here are some pics

Here are some pics

I think you will find that in that configuration the switch is always on...

You need to connect across the divide in the breadboard.

Can you explain more in detail please? I don't really know what you mean...

Guess 1: Those switches have 2 sets of connected pins, if you connect your wires to the wrong pins, the button is useless (because those pins are already connected inside the button)

Suggestion 2: Solder on some wires or some headers or get new buttons...

To elaborate further on the pins, those things look like the attached pic, inside.

square switch.JPG

Hi, your press button circuit is not right.
Do you have a DMM?
Your sketch is press on to go high,
so
one term of switch goes to +5V
the other goes to the INPUT term of the arduino.
the 10K goes from the INPUT term of the arduino to gnd.
That way the INPUT is at gnd/LOW unless you press the button and it will go HIGH.

Tom...... :slight_smile:

just check continuity in multimeter Which pins reads high when button pressed

Initially 2 pis are Normally open. when you pressed button you can check continuity

By this way tou come to know which are pin1 &2 where connection to be made