Code for Sprint 2
Dependencies: C12832 mbed rtos RangeFinder
Diff: main.cpp
- Revision:
- 7:24d62ef1ed34
- Parent:
- 4:70090f3b1f07
- Child:
- 8:fe434a018d96
--- a/main.cpp Thu Mar 12 19:57:41 2015 +0000 +++ b/main.cpp Mon Mar 23 18:07:16 2015 +0000 @@ -2,9 +2,10 @@ #include "rtos.h" #include "Servo.h" #include "C12832.h" -Servo s1(p21); -Servo s2(p22); +//Servo sPan(p21); +Servo sTilt(p22); Serial pc(USBTX, USBRX); +Servo sVert(p21); // temporary assigned 21 for testing Mutex mutexIn; Mutex mutexOut; @@ -57,10 +58,13 @@ while (true) { mutexIn.lock(); // The control code will come here - if (corHoriz[1]=='1') - s1 = s1 + 0.25; - if (corHoriz[1]=='2') - s1 = s1 - 0.25; +// if (corHoriz[1]=='1') +// s1 = s1 + 0.25; +// if (corHoriz[1]=='2') +// s1 = s1 - 0.25; + if (corVert > .5) { // check if face is below the half of the camera view + if (outVert > .5) { // check if lamp head is facing down + sVert = ; // moves lamp down by the fraction of the difference from the middle mutexIn.unlock(); Thread::wait(25); }