I have an infinite loop issue that keeps persisting in this code on my Teensy 3.1. This program is intended to take an input on Pin 0 and press the Enter key on the computer it is hooked into.
It is connected to a wire with no current but once a switch is flipped it should send a 5v Digital Signal blip to the Teensy and trigger it to run. It does function but it keeps getting caught in an infinite loop for some reason. Any help would be greatly appreciated!
// Global Variable
int signal_receiving_pin = 0;
void setup() {
// Outputting for error checking
Serial.begin(38400);
// Readying the pin for input
pinMode(signal_receiving_pin, INPUT);
}
void loop()
{
// If statement to check whether an input has been received
if (digitalRead(signal_receiving_pin) == HIGH)
{
// If the signal has been detected..
Serial.println("The signal has been received \n");
Serial.println("Now sending the ENTER signal \n");
// .. The ENTER key is sent to the computer
//Keyboard.press(KEY_ENTER);
//Keyboard.release(KEY_ENTER);
// Waiting 1 minute before allowing more input
//delay(60000); // Pause
}
else
{
// If the signal is not detected..
// it will let you know it isn't there
Serial.println("Input not detected \n");
}
}