Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Testing a switch on ATMega128

2005-01-18 by Paul Maddox

> I have the following 
> 
> 5v ------ switch ------10K resistor --- ground
>                    |
>                    |-- 330 resistor -- PORTD4
> 

huh?
Try this ;-

5v ------ switch --+---10K resistor --- ground
                             |
                             |--- PORTD4
 
This assumes the switch is the 'normally open' type.

> printf("pinb %i ",PIND4);
> if (PIND4) 

Assuming we're talking CodeVision AVR ;-
> printf("pinb %i ",PIND.4);
> if (PIND.4) 

Paul

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.