Go Down

Topic: Is it possible to use the digital OUTs as INs? [SOLVED] (Read 3890 times) previous topic - next topic

MDTech-us_MAN

#15
Oct 05, 2012, 09:14 pm Last Edit: Oct 06, 2012, 04:11 am by MDTech-us_MAN Reason: 1
Answer 1:

internal pullups:
Code: [Select]

  Serial.begin(9600);
  pinMode(53, INPUT);// assumes switch closure connects pin to Gnd
digitalWrite (53, HIGH); 


// IDE 1.0.1 also supports:
pinMode(53, INPUT_PULLUP); // seperate digitalWrite not needed



EXACTLY! that is what I needed!!! I needed the digitalWrite part! The INPUT_PULLUP does not work on pins 22-53 on the Arduino Mega.

My aim is to make a miniature keyboard. (I will need 38 buttons for that  :) :P )

Where can I get A LOT of cheap miniature buttons?
Maxwell D.

Owner and Webmaster of www.MDTech.us

CrossRoads

"The INPUT_PULLUP does not work on pins 22-53 on the Arduino Mega."

Really! Have to tuck that one away.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

retrolefty


"The INPUT_PULLUP does not work on pins 22-53 on the Arduino Mega."

Really! Have to tuck that one away.


Well I would like to see a reference source for that before tucking it away?

Lefty

MDTech-us_MAN

Thanks for the help!

No now, I have 1 more question, where can I get 38+ miniature buttons?  :P
Maxwell D.

Owner and Webmaster of www.MDTech.us

retrolefty


Thanks for the help!

No now, I have 1 more question, where can I get 38+ miniature buttons?  :P


At a elves tailor shop?

CrossRoads

Is there something here that does do the Mega pins?
https://github.com/arduino/Arduino/commit/76c964d32b13f1fc01e3a5b07460d96f2dcaecd6

How small of a button? Like a tactile switch? Through hole? Surface mount?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

MDTech-us_MAN



"The INPUT_PULLUP does not work on pins 22-53 on the Arduino Mega."

Really! Have to tuck that one away.


Well I would like to see a reference source for that before tucking it away?

Lefty



I tried. But, someone else needs to confirm too (mine might be defective or damaged during the shipment from Hong Kong to Pennsylvannia, US).
Maxwell D.

Owner and Webmaster of www.MDTech.us

CrossRoads

Arduino Mega's come from  Hong Kong now? Or did you get a clone?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

retrolefty




"The INPUT_PULLUP does not work on pins 22-53 on the Arduino Mega."

Really! Have to tuck that one away.


Well I would like to see a reference source for that before tucking it away?

Lefty



I tried. But, someone else needs to confirm too (mine might be defective or damaged during the shipment from Hong Kong to Pennsylvannia, US).


Well I sure would be suprized if that was the case. I just did a quick check on a copy of the Atmel mega1280 datasheet and it doesn't seem to exclude any pin or ports from having the avalible optional internal pull enabled:

Quote

13.2 Ports as General Digital I/O
The ports are bi-directional I/O ports with optional internal pull-ups. Figure 13-2 shows a functional
description of one I/O-port pin, here generically called Pxn


Lefty

MDTech-us_MAN





"The INPUT_PULLUP does not work on pins 22-53 on the Arduino Mega."

Really! Have to tuck that one away.


Well I would like to see a reference source for that before tucking it away?

Lefty



I tried. But, someone else needs to confirm too (mine might be defective or damaged during the shipment from Hong Kong to Pennsylvannia, US).


Well I sure would be suprized if that was the case. I just did a quick check on a copy of the Atmel mega1280 datasheet and it doesn't seem to exclude any pin or ports from having the avalible optional internal pull enabled:

Quote

13.2 Ports as General Digital I/O
The ports are bi-directional I/O ports with optional internal pull-ups. Figure 13-2 shows a functional
description of one I/O-port pin, here generically called Pxn


Lefty

I have the ATMega2560 chip


Arduino Mega's come from  Hong Kong now? Or did you get a clone?

Most likely is a worker of a factory that took it off the conveyor, put it in a package and sent it to me. LOL  :P :smiley-sweat:


Is there something here that does do the Mega pins?
https://github.com/arduino/Arduino/commit/76c964d32b13f1fc01e3a5b07460d96f2dcaecd6

How small of a button? Like a tactile switch? Through hole? Surface mount?


About as small as the reset button on the Arduino, but, with only 2 legs.

I want something that might fit on a breadboard.

Maxwell D.
Maxwell D.

Owner and Webmaster of www.MDTech.us

retrolefty

The same datasheet covers the 'family' of:

Quote

ATmega640/V
ATmega1280/V
ATmega1281/V
ATmega2560/V
ATmega2561/V


Lefty

MDTech-us_MAN


The same datasheet covers the 'family' of:

Quote

ATmega640/V
ATmega1280/V
ATmega1281/V
ATmega2560/V
ATmega2561/V


Lefty


Well... lets call it undecided. :~

Now All I need are the buttons. 8)

Quote

About as small as the reset button on the Arduino, but, with only 2 legs.

I want something that might fit on a breadboard.


Maxwell D.
Maxwell D.

Owner and Webmaster of www.MDTech.us

CrossRoads

Search for switch at taydaelectronics.com, lots of 4 pin tactile switches to choose from.
I have some 2-pin tactile switches like those, no idea where I got them.
Checked all the usual sources and am not seeing them.

They look like this
http://www.mouser.com/ProductDetail/CK-Components/PTS635VH39-LFS/?qs=sGAEpiMZZMsgGjVA3toVBBpDTNTTW0j3YRB1%252bcCi%2fno%3d
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

MDTech-us_MAN


Search for switch at taydaelectronics.com, lots of 4 pin tactile switches to choose from.
I have some 2-pin tactile switches like those, no idea where I got them.
Checked all the usual sources and am not seeing them.

They look like this
http://www.mouser.com/ProductDetail/CK-Components/PTS635VH39-LFS/?qs=sGAEpiMZZMsgGjVA3toVBBpDTNTTW0j3YRB1%252bcCi%2fno%3d



AWESOME! I will buy at the link you posted. But, will that button fit on a breadboard if I straighten the legs and maybe make them more rounded ?
Maxwell D.

Owner and Webmaster of www.MDTech.us

MDTech-us_MAN

I found more buttons at http://www.pololu.com/catalog/product/1400 but they cost $0.72 each for 10-100, which will be $31.20 for 40 buttons (a lot for me).
Maxwell D.

Owner and Webmaster of www.MDTech.us

Go Up