-
Notifications
You must be signed in to change notification settings - Fork 0
/
Guile.c
executable file
·103 lines (91 loc) · 2.55 KB
/
Guile.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#pragma config(Hubs, S1, HTMotor, none, none, none)
#pragma config(Hubs, S2, HTMotor, HTMotor, HTServo, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Sensor, S2, , sensorI2CMuxController)
#pragma config(Sensor, S3, compass, sensorI2CCustom)
#pragma config(Motor, mtr_S1_C1_1, motorWest, tmotorNormal, openLoop, reversed)
#pragma config(Motor, mtr_S1_C1_2, motorNorth, tmotorNormal, openLoop, reversed)
#pragma config(Motor, mtr_S2_C1_1, motorEast, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S2_C1_2, motorSouth, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S2_C2_1, motorH, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S2_C2_2, motorI, tmotorNormal, openLoop)
#pragma config(Servo, srvo_S2_C3_1, flag, tServoStandard)
#pragma config(Servo, srvo_S2_C3_2, servo2, tServoNone)
#pragma config(Servo, srvo_S2_C3_3, servo3, tServoNone)
#pragma config(Servo, srvo_S2_C3_4, servo4, tServoNone)
#pragma config(Servo, srvo_S2_C3_5, servo5, tServoNone)
#pragma config(Servo, srvo_S2_C3_6, servo6, tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#define C4 261.63
#define As5 466.16
#define C5 523.25
#define Cs5 554.37
#define D5 587.33
#define Ds5 622.25
#define E5 659.26
#define F5 698.46
#define G5 783.99
#define Gs5 830.61
#define As6 932.33
#define rest 0
bool flipped = false;
int mid = 128;
int diff = 30;
bool guileRunning = false;
void pt(float freq, int time)
{
if (freq != 0)
PlayTone(freq, time);
wait10Msec(time);
wait1Msec(10);
if (freq == 0)
return;
if (flipped)
servo[flag] = mid - diff;
else
servo[flag] = mid + diff;
flipped = !flipped;
}
task guile()
{
guileRunning = true;
pt(Ds5,30);
pt(Ds5,15);
pt(D5,15);
pt(rest,15);
pt(D5,15);
pt(Ds5,90);
pt(D5,30);
pt(Ds5,30);
pt(Ds5,15);
pt(D5,15);
pt(rest,15);
pt(D5,15);
pt(Ds5,90);
pt(D5,30);
pt(Ds5,15);
pt(D5,30);
pt(Ds5,15);
pt(rest,15);
pt(D5,30);
pt(F5,15);
pt(rest,15);
pt(F5,15);
pt(Ds5,30);
pt(D5,30);
pt(As5,30);
pt(C5, 90);
pt(D5, 30);
pt(Ds5, 15);
pt(F5,45);
pt(G5,60);
pt(F5,30);
pt(As6,60);
pt(Gs5,30);
pt(G5,15);
pt(Gs5,45);
pt(D5,45);
pt(Ds5,45);
pt(F5,30);
guileRunning = false;
}