Using a button to override sensor switch Help


hi all,

i in process of fine tuning garduino, self monitoring watering system. have code , kit , working well. want include switch in code enable me turn pump on manually (ie if feel plants need additional burst of watering hit space bar on laptop , trigger pump pump). dont want affect day day self operating functionality of system. should using if function switch , how piece of code fit in rest of it. code far follows;


code: [select]
//define analog inputs have connected our sensors
int moisturesensor = 0;

//define digital outputs have connecte our relays (water , light) , led (temperature)
int waterpump = 7;

//define variables store moisture, light, , temperature values
int moisture_val;



//setup variable store seconds since arduino switched on
float start_time;
float seconds_elapsed;
float seconds_elapsed_total;
float seconds_for_this_cycle;

void setup() {
 //open serial port
 serial.begin(9600);
 //set water, light, , temperature pins outputs turned off
 pinmode (waterpump, output);
 digitalwrite (waterpump, low);
}


void loop() {
 // read value moisture-sensing probes, print screen, , wait second
 moisture_val = analogread(moisturesensor);
 serial.print("moisture sensor reads ");
 serial.println( moisture_val );
 delay(1000);


 //turn water on when soil dry, , delay until soil wet
 if (moisture_val < 850)
 {
   digitalwrite(waterpump, high);
 }


 {
   delay(10000);
 }

 digitalwrite(waterpump, low);
}



thanks help

yes, can 'button' example in ide.
make sure delays don't mess timing system, delay freeze entire program.  if can @ 'blink without delay' digital example in ide.  


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Using a button to override sensor switch Help


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums