Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int sensor=A0;
- int LED = 5;
- char* pass;
- char* password = {"1234"};
- void setup() {
- Serial.begin(9600);
- pinMode(LED, OUTPUT);
- Serial.println("Enter your password:");
- Serial.readBytes(pass, 4);
- }
- void loop() {
- int value = analogRead(sensor);
- int x; //x is the line between water and air value
- if (value > x) {
- digitalWrite(LED, HIGH);
- if (!(strcmp(pass, password))) {
- digitalWrite(LED, LOW);
- }
- }
- else{
- digitalWrite(LED, LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement