Skip to content

Instantly share code, notes, and snippets.

@fxprime
Last active September 11, 2023 11:55
Show Gist options
  • Save fxprime/1eb12a33e3a18ab90d0b583b2a850e03 to your computer and use it in GitHub Desktop.
Save fxprime/1eb12a33e3a18ab90d0b583b2a850e03 to your computer and use it in GitHub Desktop.
/**
Example of Modulemore XKC-Y25-PNP (NO configuration)
Sensor ---- Arduino
(Brown) VCC = 5v
(Yellow) INPUT = digital 5 --> 4.7k ohm --> GND
(Blue) GND = GND
(Black) Not connected.
*/
int XKC_NO_PIN = 5;
void setup() {
Serial.begin(115200);
pinMode(XKC_NO_PIN, INPUT);
}
void loop() {
bool detected = digitalRead(XKC_NO_PIN);
if(detected) {
Serial.println("Liquid High");
}else{
Serial.println("Liquid Low");
}
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment