IR01A Medium Range Infrared Sensor

Digital Fiber, Photoelectric, Laser Range, Optical, Temperature, Rotary Encoder, Ultrasonic, Gas, Gyro, Accelerometer, FlexiBend, Flexiforce, Compass......

IR01A Medium Range Infrared Sensor

Postby awears affnan » Fri May 24, 2013 4:36 pm

hello...
i want to run my servo motor when ''Medium Range Infrared Sensor''(IR01A) detect the obstacle in front...
can anyone help me with arduino code....?
i also need the diagram of wiring connection for this circuit..
tq...
awears affnan
Freshie
 
Posts: 5
Joined: Mon Mar 11, 2013 5:35 pm

Re: IR01A Medium Range Infrared Sensor

Postby robosang » Fri May 24, 2013 10:29 pm

try 1st and let us see. Who have time to draw something or write code for you?
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: IR01A Medium Range Infrared Sensor

Postby awears affnan » Sat May 25, 2013 1:42 am

*correction.. not SERVO MOTOR.....
ITS A ''DC MOTOR''....

int IRsensor = A0;
int buzzer = 8;
int motorPin = 3;

void setup(){
Serial.begin(9600);
digitalWrite(8,LOW);
digitalWrite(3,LOW);

}
void loop(){
if (IRsensor=LOW);{
digitalWrite(8,HIGH);
digitalWrite(3,HIGH);
delay(1000);
digitalWrite(8,LOW);
digitalWrite(3,LOW);

}
}

Motor not run and buzzer always on... hmmm...
i'm a beginner....
awears affnan
Freshie
 
Posts: 5
Joined: Mon Mar 11, 2013 5:35 pm

Re: IR01A Medium Range Infrared Sensor

Postby robosang » Sat May 25, 2013 3:06 pm

the code .... is the problem!
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: IR01A Medium Range Infrared Sensor

Postby shahrul » Sat May 25, 2013 4:13 pm

IRsensor is analog, can't compare with LOW or HIGH.
Need to read using AnalogRead() and compare with some value.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: IR01A Medium Range Infrared Sensor

Postby awears affnan » Mon May 27, 2013 1:53 am

keep trying but always failed... arrrgghh....
awears affnan
Freshie
 
Posts: 5
Joined: Mon Mar 11, 2013 5:35 pm

Re: IR01A Medium Range Infrared Sensor

Postby robosang » Mon May 27, 2013 9:07 am

shahrul, he is using digital sensor. IR01A is one of Cytron's product. Using infrared, but is digital output.

Check your code.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: IR01A Medium Range Infrared Sensor

Postby awears affnan » Mon May 27, 2013 11:08 am

already done.. tq for ur help....
awears affnan
Freshie
 
Posts: 5
Joined: Mon Mar 11, 2013 5:35 pm

Re: IR01A Medium Range Infrared Sensor

Postby shahrul » Mon May 27, 2013 12:40 pm

robosang WROTE:shahrul, he is using digital sensor. IR01A is one of Cytron's product. Using infrared, but is digital output.

Check your code.

oh, sorry it's digital. I see the define A0, I think that is analog. hehe
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor


Return to Sensor

Who is online

Users browsing this forum: No registered users and 5 guests