Help with programming uC toggle LED using one switch

t06afre

Joined May 11, 2009
5,934
t06afre, the pix you have shown me that is the type of diagram that i am using. I had to use the external switch from outside out the uC development board, the one that is available on the board is the one same as shown in the pix HallMark have shown me and i dont know how to set up for the input pins to work.
Then an input on a digital circuit, like your MCU. Is not connected to anything it will take high level as a thumb rule. But if the input floating (not connected) it may also pick up noise, hence give an unstable response. So if you use the circuit that I posted. Your MCU will most probably se a constant high level. In the simplest form the switch should be connected like shown in the picture. The capacitor will ensure switch de-bouncing. The picture is from this site http://ikalogic.com/debouncing.php
 

HallMark

Joined Apr 3, 2011
89
Hi HallMark, the schematic diagram of your micro controller has the same switch configuration as on my uC board, by the way can you show me how to set the code up for it to work on those type on switch on PORT B, and the LEDs on PORT C , say if i press a switch bit1, led bit1 on.
Here's some pix of my uC board schematic diagram and how the switchs look like.
I had given the code in my previous post you just have to place the name of your pin in after the LED and SW.
As i don't know the register for direction in ATmega
 

Thread Starter

eagle32

Joined Feb 18, 2011
30
Thanks to eveyone for reply to my questions. I have changed my codes to the one that i am familar with and i got it working.
Thanks to you all. :)
 
Top