TeensyTinkerer
New member
Hello everyone, I recently got a Teensy 4.1 and am thrilled with its speed! (porting a project over from Arduino).
Problem:
I seem to be running into an odd issue, and am wondering if anyone knows what is going on.
I have connected an End Stop (Limit Switch) to the Teensy 4.1. It works fine (the signal pin is HIGH when the end stop is open, the signal pin is LOW when the end stop is closed), as demonstrated in the video by the LED_BUILTIN light staying HIGH when the signal pin is HIGH and LED_BUILTIN going LOW when the signal pin is LOW.
However, as soon as I open the Serial monitor, the LED_BUILTIN flickers and the Serial monitor shows the signal pin flashing between high and low.
Does anyone know why is this happening?
Video: watch video here (it wouldn't upload as an attachment for some reason)
Notes about my setup:
Code:
Any suggestions appreciated!
Problem:
I seem to be running into an odd issue, and am wondering if anyone knows what is going on.
I have connected an End Stop (Limit Switch) to the Teensy 4.1. It works fine (the signal pin is HIGH when the end stop is open, the signal pin is LOW when the end stop is closed), as demonstrated in the video by the LED_BUILTIN light staying HIGH when the signal pin is HIGH and LED_BUILTIN going LOW when the signal pin is LOW.
However, as soon as I open the Serial monitor, the LED_BUILTIN flickers and the Serial monitor shows the signal pin flashing between high and low.
Does anyone know why is this happening?
Video: watch video here (it wouldn't upload as an attachment for some reason)
Notes about my setup:
- Only wires connected to Teensy 4.1 are: SIGNAL_PIN from End Stop* connected to Teensy PIN 10, and Ground from End Stop connected to Teensy Ground
- Teensy 4.1 has the signal pin set as INPUT_PULLUP
- When the End Stop is closed, it connects the Teensy PIN 10 to Ground (making it read LOW), when the End Stop is open, the Teensy's internal Pullup Resistor makes PIN 10 read HIGH
- The End Stop cables and USB cable for Teensy 4.1 are very long (6 feet each)
Code:
Code:
//End Stop Test
#define SIGNAL_PIN 10
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(SIGNAL_PIN, INPUT_PULLUP); //external pullup being used; otherwise use INPUT_PULLUP
pinMode(LED_BUILTIN,OUTPUT);
}
void loop() {
if(digitalRead(SIGNAL_PIN) == HIGH)
{
Serial.print(SIGNAL_PIN);
Serial.print(": ");
Serial.println("HIGH");
digitalWrite(LED_BUILTIN, HIGH);
}
else if(digitalRead(SIGNAL_PIN) == LOW);
{
Serial.print(SIGNAL_PIN);
Serial.print(": ");
Serial.println("LOW");
digitalWrite(LED_BUILTIN, LOW);
}
}
Any suggestions appreciated!
Last edited: