Pages: [1]   Go Down
Author Topic: Infrared Sensors~Code to make them work?  (Read 618 times)
0 Members and 1 Guest are viewing this topic.
Montreal,Qc
Offline Offline
Newbie
*
Karma: 0
Posts: 23
I am completely new to programming but im learning fast.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone,

I'm working a project that involves using infrared sensors and infrared beamers, what i'm trying to do is basically I have the beamers and sensors on a mobile robot,I want the beamers to send out an infrared signal so it bounces off nearby surfaces and returns the signal back at the robot for the sensors to pick up.

Now I know very little about the code needed for the sensors to work but what I do know is that I need to set up code so that my Arduino is constantly monitoring the sensors, the part that i'm turning to you, the community, for help, is the part of code that measures how intense the returning signal is and when it is past a certain level because  I want a certain action to execute once it's past that level.

For example, If the intensity of returning beams is level 50+ I want the board to execute a command.

Please keep in mind that i'm a novice programmer and I rely quite heavily on these forums so if you post suggested lines of code to try to keep it simple so its easier for me to understand, that would be great.

Thanks in advance!  smiley
Logged

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 47
Posts: 2520
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You're going to want to buy a Sharp IR range sensor to do this. It's not a trivial matter to use discrete IR phototransistors and emitters to build an equivalent.

Interfacing these devices is simple; the sensor has connections for power, ground, and one connection goes to an analog pin on the Arduino. An analogRead() of that pin then returns a value between 0 to 1024 which is relative to the distance from the sensor to an object in front of it.
Logged

Montreal,Qc
Offline Offline
Newbie
*
Karma: 0
Posts: 23
I am completely new to programming but im learning fast.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for the link, it is extremely helpful!
Logged

Pages: [1]   Go Up
Jump to: