TrinketPro 5v USB digitalRead Trouble

This is a special forum devoted to educators using Adafruit and Arduino products for teaching.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
JMM
 
Posts: 2
Joined: Tue Nov 28, 2017 4:21 am

TrinketPro 5v USB digitalRead Trouble

Post by JMM »

I am working on hooking up one button to turn on /off the led on pin 13. I have tried pin 10-12 and 3-6 for the button to ground. I have checked continuity on my header, my connection wire, my bread board and my button, all is well. For whatever reason the pin never reads LOW. What am I missing!? Is there any other way to troubleshoot this. My goal is to create a little game controller by hooking up 4 buttons. This is happening on more than one of my Trinket Pro boards on Linux and Windows. BTW I am able to load up the blink example and modify it so I know I am getting code on the board. I did notice some mention of an RX bug... but not sure if that is relevant to my issue... any help would be greatly appreciated. Below is my code. Pretty standard stuff. Perhaps I have a bad board?

Code: Select all

const int PIN_BUTTON = 12;

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(PIN_BUTTON, INPUT_PULLUP);
  
}

void loop()
{
  if (digitalRead(PIN_BUTTON) == LOW)
  {
    digitalWrite(LED_BUILTIN, HIGH);
  }else{
    digitalWrite(LED_BUILTIN, LOW);
  }
}


User avatar
JMM
 
Posts: 2
Joined: Tue Nov 28, 2017 4:21 am

Re: TrinketPro 5v USB digitalRead Trouble

Post by JMM »

I feel like an idiot.. I hadn't grounded the board... placing a cable btw G and Ground got things going .. :P
Marked as closed!

Locked
Please be positive and constructive with your questions and comments.

Return to “For Educators”