Teensy 4.0 reseting on button click

Status
Not open for further replies.

mlderanian

New member
We have wired a teensy 4.0 to a single button and are trying to identify when the button is pressed, but once the button is pressed we only get that the teensy resets.

Code:


HTML:
void setup() {
  pinMode(4,INPUT_PULLUP);

}

void loop() {
 if( digitalRead(4) == HIGH){

  Serial.println("Button Pressed");
  delay(1000);
 }
}

Wiring:
singal Pin -> to 10 k resitor to -> ground and the other side of the button
3.3 v to one side of the button

Any ideas why this could be hapenning.
 
Have only seen something similar when 'main 3.3V' shorted to Ground.

With INPUT_PULLUP the pin is pulled up to 3.3V internally, there is no need to connect "3.3 v to one side of the button".

Using the button to GND that would result use this test: if( digitalRead(4) == LOW){

Try:
> signal Pin -> to one side of button
> 10 k resistor to the other side of the button to ground
 
Status
Not open for further replies.
Back
Top