Tronixlabs Support Forum
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
BennyBoyW

Junior Member
Registered:
Posts: 16
Reply with quote  #1 
Hi
This is probably going to be a really stupid noob question, so brace yourselves.
I am on the first part of Project 4 around page 66 of the book. 
As far as I can see, I have built the circui   t as per the updated instructions from https://nostarch.com/arduino (the pdf with the corrected photos and text)
However, the circuit is not working. When I push the button, nothing happens.
My thinking is that there is no connection from the 5V column to the main part of the switch. However, when I connect a 5V jumper to the top right of the switch, the LED starts to turn on whenever my finger gets near the switch.
I have tried to follow the schematic through and to my understanding, it seems to suggest that I am right in wondering where the 5V input is on the breadboard.
I am totally confused at the moment so any help would be greatly appreciated. I have attached a photo of my built circuit as it stands. 
2018-01-14 11.56.07.jpg 
Thanks, Ben

badbunny

Junior Member
Registered:
Posts: 9
Reply with quote  #2 
Hi Ben, can you take a photo zoomed out a bit to show where all of the wires are going - I've done that tutorial recently so might see something. Also can you copy and paste your sketch into here, again just in case there is a typo that a second pair of eyes might spot.

Pete.
BennyBoyW

Junior Member
Registered:
Posts: 16
Reply with quote  #3 
Hi Pete - thanks for the reply

Here's a zoomed out photo (I changed some wires for shorter ones to make them easier to follow)
2018-01-14 15.59.28.jpg 
My sketch is as follows :

 
#define LED 12
#define BUTTON 7
void setup() {
  pinMode(LED, OUTPUT);
  pinMode(BUTTON, INPUT);
}
void loop() {
  if (digitalRead(BUTTON) == HIGH) {
    digitalWrite (LED, HIGH);
    delay(500);
    digitalWrite (LED, LOW);
  }
}
 

BennyBoyW

Junior Member
Registered:
Posts: 16
Reply with quote  #4 
Well I got it working by moving everything over to one side of the breadboard. I also wired up the 5V input as I thought it should be. 
This now has no real relation to the original in the updated Chapter 4 but I am very happy that my thinking seems to have been not too far from what was needed. 
Does this look better to you Pete ?  I obviously don't quite get why I couldn't do it over the two sides of the breadboard as per the photos in the updated Chapter 4 pdf though.
2018-01-14 17.23.27.jpg 
Cheers
Ben

badbunny

Junior Member
Registered:
Posts: 9
Reply with quote  #5 
Hi Ben, on your 2nd photo you were missing the connection between the 5V Arduino output and the button, so when you were pressing the button this wasn't bringing the D7 digital input to high (ie the 5V). My copy of the book had the error fixed already. I hope for future editions they just show a single photo of the completed circuit rather than step by step photos which confusingly keep being shown at different orientations.

Also on your last picture I don't think it's right still. You have the capacitor going across the button's terminals, whereas the resistor and capacitor should be in parallel off one of the button's terminals to both D7 and ground. Then  the 5V is connected to the other button terminal. In my copy of the book this is easiest to see on Figure 4-22.

I found Figure 4-19 confusing at first, but try to visualise it as the button with R2 and C1 (in parallel) go to ground, and the LED wire with R1 and LED1 also go to ground independently of the other wire. Just on the picture they merge together at the horizontal line below R2, C1 and LED1 (which are all at ground).

Pete.
BennyBoyW

Junior Member
Registered:
Posts: 16
Reply with quote  #6 
Hi Pete
Yeah - that was my thinking all along - nowhere in the photos in the book does it seem to me to get a connection from the 5Vcolumn on the breadboard onto the rows of the breadboard itself.
I still cannot quite understand why the split breadboard version did not work for me. Could it be something to do with the type of breadboard I'm using ?
I was quite pleased when I shifted everything over to the one side, made a few assumptions and tried it and it worked though.
Cheers and thanks for all the help here,
Ben
badbunny

Junior Member
Registered:
Posts: 9
Reply with quote  #7 
Hi Ben, on your split breadboard version I think you were just missing the wire linking the 5V to the button terminal on row 16.

Pete.
BennyBoyW

Junior Member
Registered:
Posts: 16
Reply with quote  #8 
..... and also I just finally noticed the missing 5V wire in the photos in the book so I definitely did not spot that first time around. I've redone things taking into account your messages about the capacitor going across the button's terminals etc.
Thanks for everything you've suggested - you've been extremely helpful. Hopefully the version at the bottom of this message is better - if you could take a quick peek and let me know then I'd be extremely grateful.
Have you used Fritzing much ?  I tried it out while I was trying to figure this problem out and it looks extremely useful. I think I'll have to spend some time to get to know it properly though.
2018-01-14 18.14.03.jpg 
Thanks again
Ben

badbunny

Junior Member
Registered:
Posts: 9
Reply with quote  #9 
Hi Ben, it looks right to me. I did have a look at Fritzing, but ended up playing around with http://www.tinkercad.com which lets you not only draw a circuit but also simulate how it works which is cool!

Pete.
BennyBoyW

Junior Member
Registered:
Posts: 16
Reply with quote  #10 
Good tip. I'll take a look at that.
Thanks once again for all the help.
Ben
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.