Last active
August 24, 2021 07:43
-
-
Save ShawnHymel/a7c6cd17f00dd10e4325f72f83842be1 to your computer and use it in GitHub Desktop.
Sample Arduino code for the SST Liquid Level Sensor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Liquid level detection using an SST sensor | |
// | |
// When a liquid touches the tip of the sensor, | |
// an LED at pin 13 turns on. | |
// | |
// Hardware: | |
// Sensor | Arduino | |
// -------------|--------- | |
// Vs (RED) | 5V | |
// Out (GREEN) | pin 7 | |
// GND (BLUE) | GND | |
// Pins | |
const int LIQUID_SENSOR_PIN = 7; | |
const int LED_PIN = 13; | |
void setup() { | |
pinMode(LIQUID_SENSOR_PIN, INPUT); | |
pinMode(LED_PIN, OUTPUT); | |
digitalWrite(LED_PIN, LOW); | |
} | |
void loop() { | |
// Read sensor. If liquid touches the tip, the sensor will | |
// read 0V. Turn on LED if liquid is present. | |
int isDry = digitalRead(LIQUID_SENSOR_PIN); | |
if ( isDry ) { | |
digitalWrite(LED_PIN, LOW); | |
} else { | |
digitalWrite(LED_PIN, HIGH); | |
} | |
delay(200); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please code for python raspberry pi
Regards