Noob Problem :( Plz help

Hi gyus, I am new to the Arduino and embedded world. I am trying to get the exmaple sketch to work but its not working corretcly... The exmaple sketch is the one that reads a button and writes HIGH or LOW to hyperterminal. THe problem is that I have nothing connected to the board (except usb of coarse) but Arduino constantly writes random HIGHs and LOWs to the serial port:o :'( :'( :-[

I tried using the whole setup with a button and LED but same issue!!! Did I get a bad board? (BTW other sketched that read from digital and then write behave spuriously also :'()

Thanks in advance guys..

Figured it out :-[
It should randomly indicate a HIGH or LOW when nothing connected to it since it’ll be floating… I thought Arduino had pulldowns on the board… I guess im wrong…

The ATmega has internal pullups, but they are not enabled by default.

-j

The ATmega has internal pullups, but they are not enabled by default.

Can I enable the pullups for specific digital Pins (10-13) from my own library code? (I seem to have a problem with an SPI ChipSelect Line after reseting the board for uploads)

Eberhard

Check the ATmega manual for details, but I [u]think[/u] if you set the pin as an input, then write a 1 to it, it enables the pullup.

-j

Thanks for the hint!

Check the ATmega manual for details, but I [u]think[/u] if you set the pin as an input, then write a 1 to it, it enables the pullup.

I checked it with the manual and you are right. But the internal pull-ups get disabled when the pin is later used as an output again. Since I use the pin in question only as an output in SPI code, the internal pull-ups won't work. I will add an external pull-up resistor to my hardware then.

Thanks again Eberhard

Since I use the pin in question only as an output in SPI code, the internal pull-ups won't work.

If it's only used for an SPI line (SDO, I assume), why do you need a pullup? A well behaved SPI peripheral (some aren't) will put its SDI in a high impedence state unless its chip select is active.

-j

The problem seems to be with the ChipSelect Line. I use the MAX7221 Led matrix driver and after a reset of the arduino there seems to be some jitter on the pin I use for the ChipSelect Line. The MAX7221 now thinks there is new data and latches onto its display whatever command is in the register.

Sometimes by accident, this happens be the displaytest command which overrides every other command on this chip. The external pull-up seems to work.

Eberhard