Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Teensy 4.0 reseting on button click

  1. #1
    Junior Member
    Join Date
    Sep 2021
    Posts
    2

    Teensy 4.0 reseting on button click

    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 Code:
    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.

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    15,094
    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

  3. #3
    Junior Member
    Join Date
    Sep 2021
    Posts
    2
    That worked, thank you so much!

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    15,094
    - Awesome.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •