Skip to content

Instantly share code, notes, and snippets.

@buildcircuit
Created August 26, 2015 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buildcircuit/d5969964bac419272170 to your computer and use it in GitHub Desktop.
Save buildcircuit/d5969964bac419272170 to your computer and use it in GitHub Desktop.
Digital Thermal / Temperature Sensor Module with Thermistor- for Arduino
const int sensorDOPin = 2; // connect DO pin to pin 2 of Arduino
const int ledPin = 13; // the number of the LED pin
// variables will change:
int SensorState = 0; // variable for the state of the sensor
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the sensor pin DO as input
pinMode(sensorDOPin, INPUT);
}
void loop() {
// read the state of the sensor value:
SensorState = digitalRead(sensorDOPin);
// by default, the sensor sends a HIGH all the time
//if the sensor sends a LOW
if (SensorState == LOW) {
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment