-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIR Testing.c
60 lines (56 loc) · 1.83 KB
/
IR Testing.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma config(Hubs, S1, HTMotor, HTServo, none, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Sensor, S3, IR, sensorHiTechnicIRSeeker1200)
#pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, openLoop, reversed)
#pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, openLoop)
#pragma config(Servo, srvo_S1_C2_1, servo1, tServoStandard)
#pragma config(Servo, srvo_S1_C2_2, servo2, tServoNone)
#pragma config(Servo, srvo_S1_C2_3, servo3, tServoNone)
#pragma config(Servo, srvo_S1_C2_4, servo4, tServoNone)
#pragma config(Servo, srvo_S1_C2_5, servo5, tServoStandard)
#pragma config(Servo, srvo_S1_C2_6, servo6, tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c" //Include file to "handle" the Bluetooth messages.
int x;
task main{
/*
while (true)
{
if (SensorValue[IR] < 3)
{
motor[motorD] = -40;
motor[motorE] = 40;
}
else if (SensorValue[IR] > 3 && SensorValue[IR] < 5)
{
motor[motorD] = -40;
motor[motorE] = 40;
}
else if (SensorValue[IR] > 7)
{
motor[motorD] = 40;
motor[motorE] = -40;
}
else if (SensorValue[IR] > 5 && SensorValue[IR] < 7)
{
motor[motorD] = 40;
motor[motorE] = -40;
}
else if (SensorValue[IR] > 4 && SensorValue[IR] < 6)
{
motor[motorD] = 20;
motor[motorE] = 20;
}
nxtDisplayTextLine(5, "Value is : %4d" + SensorValue[IR]);
}*/
if(joy1Btn(9) == 1)
{
//servo[servo3] = 225;
servo[servo5] = 200;
}
else if (joy1Btn(10) == 1)
{
//servo[servo3] = 100;
servo[servo5] = 155;
}
}