Pages: 1 [2] 3 4   Go Down
Author Topic: Is it possible to use the digital OUTs as INs? [SOLVED]  (Read 3390 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Answer 1:
internal pullups:
Code:
  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  smiley smiley-razz )

Where can I get A LOT of cheap miniature buttons?
« Last Edit: October 05, 2012, 09:11:49 pm by MDTech-us_MAN » Logged

Maxwell D.

Owner and Webmaster of www.MDTech.us

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27089
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Really! Have to tuck that one away.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the help!

No now, I have 1 more question, where can I get 38+ miniature buttons?  smiley-razz
Logged

Maxwell D.

Owner and Webmaster of www.MDTech.us

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the help!

No now, I have 1 more question, where can I get 38+ miniature buttons?  smiley-razz

At a elves tailor shop?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27089
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"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).
Logged

Maxwell D.

Owner and Webmaster of www.MDTech.us

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27089
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"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  smiley-razz 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.
Logged

Maxwell D.

Owner and Webmaster of www.MDTech.us

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The same datasheet covers the 'family' of:

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

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The same datasheet covers the 'family' of:

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

Lefty

Well... lets call it undecided. smiley-confuse

Now All I need are the buttons. smiley-cool

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.
Logged

Maxwell D.

Owner and Webmaster of www.MDTech.us

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27089
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ?
Logged

Maxwell D.

Owner and Webmaster of www.MDTech.us

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

Maxwell D.

Owner and Webmaster of www.MDTech.us

Pages: 1 [2] 3 4   Go Up
Jump to: