This look good? I didn't even know about the internal pull-up on the arduino. I love this community. ![]()
void setup() {
pinMode (SENSOR, INPUT); //sets SENSOR as an input
digitalWrite(SENSOR, HIGH); //enables the internal pull-up
pinMode (TRANSISTOR, OUTPUT); //sets the TRANSISTOR as an output
digitalWrite(TRANSISTOR, LOW); //set the initial state of the transistor to low
Serial.begin(9600); //sets up the serial port
}