0

lezzon 5
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

lezzon 5

by adafruit on Thu Nov 01, 2007 11:41 pm

check it out, post feedback
woot
http://www.ladyada.net/learn/arduino/lesson5.html

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by lmc169 on Fri Nov 02, 2007 5:40 pm

yippee! :D
lmc169
 
Posts: 32
Joined: Fri Oct 19, 2007 6:06 am

by magician13134 on Fri Nov 02, 2007 10:50 pm

Huh, I've been trying all day, and I can't get it working. The digitalread command is really buggy... I haven't gone past the part with a single button. Sometimes when I run it, it returns all '1's, other times, all zeros, and sometimes a random mix. This happens when button it pushed, unpushed, not attached, or with a jumper straight from power to pin 2... Any one else having troubles, or just me?
magician13134
 
Posts: 1119
Joined: Wed Jun 13, 2007 9:17 am
Location: Ann Arbor

by adafruit on Sat Nov 03, 2007 3:08 am

you should post a nice photo of what you have wired up

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by big93 on Thu Nov 22, 2007 12:18 am

nice!!!
one question :

how do i install the drivers stated in the beginning of the lesson, do i just put the mian folder on my desktop, and then i'm good, or do i need to "install it"? becuase i saw no way of installing it... other then that:

i read it and its sweet, when i get my stuff it looks like sumthin rly fun to do, thnks for doin it!
big93
 
Posts: 56
Joined: Wed Nov 21, 2007 10:31 pm

by adafruit on Thu Nov 22, 2007 2:30 am

when you plug it in it will start the process automatically

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: lezzon 5

by tomp on Sat Dec 08, 2007 12:31 pm

ladyada wrote:check it out, post feedback
woot


This was a great lesson. Now I (finally) know what pull-up and pull-down resistors are! The business of having to debounce the switch is also kind of interesting; the 10ms delay trick you suggest works pretty well, but every now and then I still have to hit the switch twice or it thinks one button press was really two.

Anyway, I uploaded a little movie of my blinky lights to YouTube. You can see it at http://www.youtube.com/watch?v=YkR-i49HIko

Looking forward to lesson 6!

tomp
 
Posts: 57
Joined: Sun Nov 25, 2007 9:07 pm
Location: South Orange, NJ

by adafruit on Sat Dec 08, 2007 2:42 pm

yow you really went all out, thats like 234092 modes!

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by magician13134 on Mon Dec 10, 2007 8:12 pm

Nice video TomP!

As for my problem, I tried again today, and got the same thing! I tried replacing the switch. Exact same thing. I've tried EVERY possible switch orientation. Ok, so here's my problem, as detailed as possible.

I have the switch test code, straight from ladyada.net, the first one example in this lesson. I have a jumper from 5V to a switch, out to a 100ohm resistor, to pin 2. I get a mix of '1's and '0's. I unplug the 5V to switch it to ground. (Still getting a mix, every when there's NO POWER to the circuit). Plug it into ground. SAME THING! Any ideas at all?!?! I'm looking for my camera which I seem to have misplaced....
magician13134
 
Posts: 1119
Joined: Wed Jun 13, 2007 9:17 am
Location: Ann Arbor

Lesson 6?

by phil007 on Wed Dec 12, 2007 9:17 pm

Will lessons 6 through 11 be online soon? I'm ordering the Arduino Starter Pack and Protoshield this week. The week during Christmas will be a good time for me to go through all the lessons.

Thanks!
Phil

phil007
 
Posts: 9
Joined: Wed Dec 12, 2007 9:09 pm
Location: Round Rock, TX

by timv on Wed Dec 12, 2007 9:23 pm

I have the switch test code, straight from ladyada.net, the first one example in this lesson. I have a jumper from 5V to a switch, out to a 100ohm resistor, to pin 2. I get a mix of '1's and '0's. I unplug the 5V to switch it to ground. (Still getting a mix, every when there's NO POWER to the circuit). Plug it into ground. SAME THING! Any ideas at all?!?!

Ya gotta go Sherlock Holmes on this stuff. Whatever the line is... "When you've ruled out the impossible whatever remains, however improbable, must be the truth."

Go back to basics. If you hook a 100 ohm resistor between the port and +5 does it always read 1? If you hook it to ground does it always read 0?

If you have a problem there then either you have a problem with your Arduino, or you're actually hooking it to another port than the one you think you are, or you read-enabled the wrong port, or there's some other outside-the-box answer you haven't been considering.

If using just the resistor does give 1 and 0 as expected, then wire like the example circuit, but use a plain piece of wire to close the circuit instead of the switch. What happens then?

I can testify that it did work for me just as described, so something's not right in your setup. Simplify the experiment until you can finally trap the problem in a very small box.
timv
 
Posts: 82
Joined: Thu Nov 01, 2007 4:13 pm

Re: Lesson 6?

by adafruit on Wed Dec 12, 2007 9:25 pm

phil007 wrote:Will lessons 6 through 11 be online soon? I'm ordering the Arduino Starter Pack and Protoshield this week. The week during Christmas will be a good time for me to go through all the lessons.


new lessons go up when i have time. next lesson will be up probably late dec. after all the xmas orders go thru

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by magician13134 on Fri Dec 14, 2007 4:42 pm

timv wrote:
I have the switch test code, straight from ladyada.net, the first one example in this lesson. I have a jumper from 5V to a switch, out to a 100ohm resistor, to pin 2. I get a mix of '1's and '0's. I unplug the 5V to switch it to ground. (Still getting a mix, every when there's NO POWER to the circuit). Plug it into ground. SAME THING! Any ideas at all?!?!

Ya gotta go Sherlock Holmes on this stuff. Whatever the line is... "When you've ruled out the impossible whatever remains, however improbable, must be the truth."

Go back to basics. If you hook a 100 ohm resistor between the port and +5 does it always read 1? If you hook it to ground does it always read 0?

If you have a problem there then either you have a problem with your Arduino, or you're actually hooking it to another port than the one you think you are, or you read-enabled the wrong port, or there's some other outside-the-box answer you haven't been considering.

If using just the resistor does give 1 and 0 as expected, then wire like the example circuit, but use a plain piece of wire to close the circuit instead of the switch. What happens then?

I can testify that it did work for me just as described, so something's not right in your setup. Simplify the experiment until you can finally trap the problem in a very small box.


I went about as basic as you can get.... I plugged in my Arduino, NOTHING plugged into any of the pins (not even the proto shield at this point), recopied the code, compiled and uploaded, clicked 'serial monitor' and got a mix of ones and zeros.

Then I decided to do what you said, attach it to ground, so I did, clicked reset on the Arduino, and same thing... :cry:

What do I do now?!
magician13134
 
Posts: 1119
Joined: Wed Jun 13, 2007 9:17 am
Location: Ann Arbor

by tomp on Fri Dec 14, 2007 5:45 pm

magician13134 wrote:I went about as basic as you can get.... I plugged in my Arduino, NOTHING plugged into any of the pins (not even the proto shield at this point), recopied the code, compiled and uploaded, clicked 'serial monitor' and got a mix of ones and zeros.

Then I decided to do what you said, attach it to ground, so I did, clicked reset on the Arduino, and same thing... :cry:

What do I do now?!


You should really take a photo of your board, wired up the way you had it for this experiment, and post it here, so that everyone can see exactly what you're doing. You should also send a copy of the sketch you're using (even if it's the same as the one from the lesson). The symptom you describe suggests that pin 2 is floating (it's not connected to any voltage source), but you say it is connected to ground. So, the only way anyone will be able to make sense of this is too see exactly what's connected to what on your board.

One thing that comes to mind is that there are actually two pins on the Arduino that are labelled as 'pin 2' - one is in the group of 6 numbered pins labelled 'ANALOG IN' (0-5), and the the other is in the group of 14 numbered pins labelled 'DIGITAL' (0-13). You should only be using the 'DIGITAL' pin 2 in this lesson. (Those pins are on the opposite side of the board from the pin labelled '5V'.)

Another thing I wanted to say is that you shouldn't be connecting the 5V pin to any of the DIGITAL i/o pins directly, because you could fry the pin if it hasn't first been configured as an input pin. (Ladyada has a warning about that in the lesson - that's why the switch is connected to the pin thru a resistor.) It's conceivable that if you did do that, the pin looks like it's floating because it's been damaged.

Anyway, I hope you get this figured out. This whole Arduino thing is a lot fun.

Tom

tomp
 
Posts: 57
Joined: Sun Nov 25, 2007 9:07 pm
Location: South Orange, NJ

by magician13134 on Sat Dec 15, 2007 4:50 pm

*Sigh* Everything SEEMS like it should work just fine... but it isn't. Here are some pictures...
Simple switch test:
Image
That seems to work:
Image
Arduino seems to think it's ok...
Image
Circuit ready to run:
Image
Another shot of the same circuit:
Image
All ones?! The button isn't pressed! Sometimes with this same setup, I get a mix of ones and zeros too...
Image
magician13134
 
Posts: 1119
Joined: Wed Jun 13, 2007 9:17 am
Location: Ann Arbor

Please be positive and constructive with your questions and comments.