Nov 23, 2012 #1 S sujeethaa Junior Member level 3 Joined Nov 18, 2012 Messages 26 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Location bangalore Activity points 1,464 hi all <60=motor on >75=motor off bet 60 to 75 = previous status how can i write the c code for this status thanks in advance
hi all <60=motor on >75=motor off bet 60 to 75 = previous status how can i write the c code for this status thanks in advance
Nov 23, 2012 #2 I internetuser2k12 Banned Joined Jul 25, 2012 Messages 1,192 Helped 171 Reputation 342 Reaction score 162 Trophy points 1,343 Activity points 0 see this link https://www.edaboard.com/threads/272349/ Code: #define MOTOR PORTB.0 unsigned int adc_val; unsigned int prev_state; if(adc_val < 60) { MOTOR = 1; prev_state = 1; } else if(adc_val > 75) { MOTOR = 0; prev_state = 0; } else if((adc_val >= 60) && (adc_val <=75)) { MOTOR = prev_state; } Last edited: Nov 23, 2012
see this link https://www.edaboard.com/threads/272349/ Code: #define MOTOR PORTB.0 unsigned int adc_val; unsigned int prev_state; if(adc_val < 60) { MOTOR = 1; prev_state = 1; } else if(adc_val > 75) { MOTOR = 0; prev_state = 0; } else if((adc_val >= 60) && (adc_val <=75)) { MOTOR = prev_state; }
Nov 23, 2012 #3 Tahmid Advanced Member level 6 Joined Jun 17, 2008 Messages 4,756 Helped 1,798 Reputation 3,588 Reaction score 1,656 Trophy points 1,413 Location Berkeley, California Activity points 30,586 What are 60 and 75? Are they relative humidity? Which moisture sensor are you using?