NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » nOOb looking for additional explanation

April 21, 2012
by spideyt
spideyt's Avatar

So I just finished the starter thermometer kit and I get all the wiring, but the programing I'm not so sure about. The first thing I was trying to determine was where in the code to I tell the program to read from PC0, is that what the ADMUX = 0; statement does? So if I changed the middle pin of the temp sensor from 16 to 15 (PC0 to PC1) and then changed the code to set ADMUX =1; should that work? It didn't seem to for me, but I might have knocked some other wire loose.

I thought I might add a couple LEDs to the project and if the temp was above some level one light would go turn on, if it was below another level the other light would turn on. It's not clear to me what I would need to add to the code to make it obey my wishes. I think the LED's legs would be connected to whatever pin and ground. Are there any sample projects that would do something similar? I saw the traffic light controller, but that seemed a step further than what I wanted.

Any help would be appreciated,

April 22, 2012
by Ralphxyz
Ralphxyz's Avatar

Hi spideyt, welcome.

"So if I changed the middle pin of the temp sensor from 16 to 15 (PC0 to PC1) and then changed the code to set ADMUX =1;"

Search the forum for multi sensor to see some discussions and code samples.

"Are there any sample projects that would do something similar?"

Start with the led-blink project.

You are on a good track your comprehension so far is right on.

Ralph

April 23, 2012
by spideyt
spideyt's Avatar

So where do I find the led-blink project? I didn't see it in the project section and when I did a search on it I found a bunch of links relating to modifying the code.

April 23, 2012
by pcbolt
pcbolt's Avatar

spideyt -

You can get the source code in the "Members" area, "Download" section under "Nerdkits Sample Source Code".

April 24, 2012
by spideyt
spideyt's Avatar

I guess I'm looking for the set up in addition to the code, do I need to put a resistor in along with the LED?

April 24, 2012
by pcbolt
pcbolt's Avatar

spideyt -

You don't really "need" to put a resistor in the output circuit, but it is usually a good idea to limit the current a little. You can use the 33 ohm resistor (red-orange-black) that came with the kit. Put one leg of the resistor on the PC4 row (pin 27), the other leg on an empty row, then the long leg of the LED on the same empty row and finally the short leg of the LED into the ground rail. A 1K resistor will work as well, but the LED is dimmer.

Post a Reply

Please log in to post a reply.

Did you know that 20 LEDs can be controlled from 11 microcontroller pins, to make a twinkling heart outline? Learn more...