Flora can't read D11 button press

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Flora can't read D11 button press

Postby wingnut59 » Tue Mar 05, 2013 11:05 pm

I have 3 buttons connected to D09, D10, D11 to read one of 7 states I want my project to be in. I can read from D09 and D10 just fine, can't seem to read from D11. The code from my project where the buttons are setup is as follows.

#define BUTTON1_PIN 9
#define BUTTON2_PIN 10
#define BUTTON3_PIN 11
#define BUTTON_DELAY 20

void setup() {
pinMode(BUTTON1_PIN, INPUT);
digitalWrite(BUTTON1_PIN,HIGH); // pull-up
pinMode(BUTTON2_PIN, INPUT);
digitalWrite(BUTTON2_PIN,HIGH); // pull-up
pinMode(BUTTON3_PIN, INPUT);
digitalWrite(BUTTON3_PIN,HIGH); // pull-up
Serial.begin(9600);
strip.begin();

// Update the strip, to start they are all 'off'
int i;
for (i=0;i<strip.numPixels(); i++){
strip.setPixelColor(i,Color(225, 128, 0));
}
strip.show();
}

// then the area where I read the buttons.

int button_pressed = 0;
// Some example procedures showing how to display to the pixels
boolean button1_pressed = handle_button1();
if (button1_pressed){
button_pressed += 1;
}
boolean button2_pressed = handle_button2();
if (button2_pressed) {
button_pressed +=2;
}
boolean button3_pressed = handle_button3();
if (button3_pressed) {
button_pressed +=4;
}
Serial.print(button_pressed);


switch(button_pressed) {
some code...

Do I have to do something special to use D11?

Thanks
Mike
wingnut59
 
Posts: 4
Joined: Tue Mar 05, 2013 10:55 pm

Re: Flora can't read D11 button press

Postby adafruit_support_rick » Wed Mar 06, 2013 7:50 am

Are you sure you have a secure connection to D11? You might try touching up the solder. Have you tried a different pin instead of D11?

BTW, Arduino added an INPUT_PULLUP configuration. You can replace this:
Code: Select all
pinMode(BUTTON1_PIN, INPUT);
digitalWrite(BUTTON1_PIN,HIGH); // pull-up

with this:
Code: Select all
pinMode(BUTTON1_PIN, INPUT_PULLUP); // enable pull-up
User avatar
adafruit_support_rick
 
Posts: 2844
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Flora can't read D11 button press

Postby wingnut59 » Wed Mar 06, 2013 8:02 pm

Thanks for the pull-up info, I'll take a look at my solder joints again but they look good. maybe my switch is malfunctioning.
Mike
wingnut59
 
Posts: 4
Joined: Tue Mar 05, 2013 10:55 pm


Return to Other Arduino products from Adafruit

Who is online

Users browsing this forum: No registered users and 4 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [105]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]