Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup()
- {
- pinMode( 2 , OUTPUT);
- pinMode( 12 , OUTPUT);
- Serial.begin(9600);
- }
- int _ABVAR_1_waterlevel = 0 ;
- boolean set=false;
- int count=0;
- void loop()
- {
- if (( ( 500 ) < ( analogRead(0) ) ))
- {
- digitalWrite( 2 , HIGH );
- }
- else
- {
- digitalWrite( 2 , LOW );
- }
- delay( 100 );
- Serial.print("light value is");
- Serial.print(analogRead(0));
- Serial.println();
- _ABVAR_1_waterlevel = ( analogRead(5) / 10 ) ;
- if (( ( 14 ) > ( _ABVAR_1_waterlevel ) )&&!set)
- {
- digitalWrite( 12 , HIGH );
- }
- else
- {
- if(count==10){
- digitalWrite( 12 , LOW );
- set=false;
- count=0;
- }
- }
- delay( 100 );
- Serial.print("% water level is");
- Serial.print(_ABVAR_1_waterlevel);
- Serial.println();
- count=count+1;
- delay(100);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement