|
Casey890
Rookie
Joined: Mon Feb 27, 2012 5:26 pm Posts: 19
|
 Ir beacon to light sensor
The goal is to use a standard Ir seeker code to then as soon as the light sensor reads the white tape. There will be two one in front and back to straighten out the robot and then use of a lego servo motor to act as a touch sensor any ideas or suggestions? Just the ir part of the code is here.
 |
 |
 |
 |
Attachments:
File comment: #pragma config(Hubs, S1, HTMotor, HTMotor, none, none) #pragma config(Sensor, S1, , sensorI2CMuxController) #pragma config(Sensor, S2, Irseeker, sensorHiTechnicIRSeeker1200) #pragma config(Sensor, S3, light, sensorNone) #pragma config(Sensor, S4, sonar, sensorNone) #pragma config(Motor, mtr_S1_C1_1, right1, tmotorTetrix, openLoop, reversed) #pragma config(Motor, mtr_S1_C1_2, right2, tmotorTetrix, openLoop, reversed) #pragma config(Motor, mtr_S1_C2_1, left1, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C2_2, left2, tmotorTetrix, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c"
task main() { while (1 == 1) { if(SensorValue[Irseeker] == 5) { motor[left1] = 15; motor[left2] = 15; motor[right1] = 15; motor[right2] = 15;
}
if(SensorValue[Irseeker] > 5) { motor[left1] = -15; motor[left2] = -15; motor[right1]= 15; motor[right2]= 15; } if(SensorValue[Irseeker] < 5) { motor[left1] = 15; motor[left2] = 15; motor[right1] = -15; motor[right2] = -15; } }}
Ir seeker .c [896 Bytes]
Downloaded 74 times
|
 |
 |
 |
 |
|
|
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1023
|
 Re: Ir beacon to light sensor
Don't really understand your scenario nor your question. You need to give us more details on what you want to achieve and what are the current problems.
|