Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to control motor with sensor ?

Status
Not open for further replies.

bianchi77

Advanced Member level 4
Joined
Jun 11, 2009
Messages
1,313
Helped
21
Reputation
44
Reaction score
20
Trophy points
1,318
Location
California
Activity points
9,442
Guys,

How to control motor with sensor ?
I'm using AT89LV55 and Keil

with this code the motor always "ON" even the sensor is OFF
sensor active H and Motor active L

Thanks
Code:
#define TRUE 1          //some defines
#define FALSE 0
// Define the keypad start
sbit sensor1=P0^0;  // Sensor 1
sbit motor1=P0^1;  // Motor 1

void main()

{
motor1=TRUE;
sensor1=FALSE;
 while(1)
  {
     
   if (sensor1=FALSE) // if there's nothing at the sensor
	 {
	   motor1=TRUE;  // deactivated the relay to turn off motor
	 }

   else
     {
	   motor1=FALSE; // activated the relay to turn on motor
	 }
  
   }//end of while
}
 

Guys,

How to control motor with sensor ?
I'm using AT89LV55 and Keil

with this code the motor always "ON" even the sensor is OFF
sensor active H and Motor active L

Thanks
Code:
#define TRUE 1          //some defines
#define FALSE 0
// Define the keypad start
sbit sensor1=P0^0;  // Sensor 1
sbit motor1=P0^1;  // Motor 1

void main()

{
motor1=TRUE;
sensor1=FALSE;
 while(1)
  {
     
   if (sensor1=FALSE) // if there's nothing at the sensor---------->[COLOR="#00FF00"]its a assignment statement[/COLOR]
	 {
	   motor1=TRUE;  // deactivated the relay to turn off motor
	 }

   else
     {
	   motor1=FALSE; // activated the relay to turn on motor
	 }
  
   }//end of while
}
hi what a pblm occured in your coding?
what type of sensor you r using?
and cgheck ur coding
if (sensor1=FALSE) is an assignment statement
write if (sensor1==FALSE) and compile.

with regards
 

hi what a pblm occured in your coding?
what type of sensor you r using?
and cgheck ur coding
if (sensor1=FALSE) is an assignment statement
write if (sensor1==FALSE) and compile.

with regards

I'm using PIR sensor..
 

use adc channel.
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top