Motor status based on moisture sensor using 8051

Status
Not open for further replies.

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
 

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:

What are 60 and 75? Are they relative humidity? Which moisture sensor are you using?
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…