|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
INFRARED SENSORS
can any one please assist me on how to program an infrared sensor in autonomous mode, and give a sample code for it in windriver c++?? (i never learned how to program any)
Quote:
Last edited by krudeboy51 : 04-08-2010 at 06:33 AM. |
|
#2
|
|||||
|
|||||
|
Re: INFRARED SENSORS
"Programming" an input is just a matter of reading its value and testing it to decide what the program should do. What do you want the program to do?
What output does the sensor provide? If it's the equivalent of a switch, it goes to a digital input. If it's a varying voltage related to the distance from the sensor to the target, it goes to an analog input. You can do anything in the autonomous routine that you would do in teleoperated mode. PWM pins on the Digital Sidecar are outputs only. They can't read sensors. |
|
#3
|
||||
|
||||
|
Re: INFRARED SENSORS
Quote:
Quote:
|
|
#4
|
|||||
|
|||||
|
Re: INFRARED SENSORS
InfraredSensor->Get() will return the state of the input. This method is featured prominently in the documentation for the DigitalInput class, isn't it?
|
|
#5
|
||||
|
||||
|
Re: INFRARED SENSORS
Quote:
Quote:
Last edited by krudeboy51 : 04-08-2010 at 07:34 PM. |
|
#6
|
|||||
|
|||||
|
Re: INFRARED SENSORS
It will return a boolean value. Typically true means the signal on the DIO pin is a high voltage (5v) and false means it is a low voltage (0v). Since there is a pullup resistor on the input, an open circuit will read true and a switch closure to ground will read false.
I don't really understand the rest of your question, but the documentation should answer anything you need to know. |
|
#7
|
||||
|
||||
|
Re: INFRARED SENSORS
InfraredSensor->Get() has no parameters, so nothing needs to go inside the parentheses. I think that was the question.
You want something like Code:
if (InfraredSensor->Get()) myRobot->Set(0.0); |
|
#8
|
||||
|
||||
|
Re: INFRARED SENSORS
Thanks alot!!
![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| InfraRed Problem | tbd | Sensors | 10 | 01-27-2008 02:01 AM |
| where can we buy hall effect sensors or gear tooth sensors | amirjpl | Electrical | 3 | 02-13-2006 11:02 AM |
| IR (infrared) sensors | Chris.Steimel | Electrical | 5 | 02-11-2005 06:46 PM |
| IR (infrared) sensors | Chris.Steimel | Programming | 0 | 02-09-2005 06:04 PM |
| InfraRed = gps ? | nzj1 | General Forum | 17 | 01-11-2004 04:58 PM |