Skip to content

Instantly share code, notes, and snippets.

@ShawnHymel
Last active August 24, 2021 07:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShawnHymel/a7c6cd17f00dd10e4325f72f83842be1 to your computer and use it in GitHub Desktop.
Save ShawnHymel/a7c6cd17f00dd10e4325f72f83842be1 to your computer and use it in GitHub Desktop.
Sample Arduino code for the SST Liquid Level Sensor
// 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);
}
@Blanchboy
Copy link

Please code for python raspberry pi
Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment