KL25Z firmware. Responsible for activating the servo based on input from the nRF51822.
Fork of HW5_Servo by
main.cpp
- Committer:
- sunitav
- Date:
- 2014-11-07
- Revision:
- 0:9898eeeb7143
- Child:
- 1:19dd18051447
File content as of revision 0:9898eeeb7143:
// Hello World to sweep a servo through its full range #include "mbed.h" #include "Servo.h" Servo myservo(D2); //change digital pin here bool ServoLogic=true; AnalogIn pin0(A0); AnalogIn pin1(A1); AnalogIn pin2(A2); AnalogIn pin3(A3); float photoresistors[4]; #define THRESHOLD .001 int counter = 0; int main() { myservo.calibrate(.0006, 75.0); while(1){ //recieve_data(ServoLogic); if (ServoLogic) { float o = .1; myservo = o; } else{ float f= 0.28; myservo = f; } photoresistors[0] = pin0.read(); photoresistors[1] = pin1.read(); photoresistors[2] = pin2.read(); photoresistors[3] = pin3.read(); for(int p=0; p<3; p += 1) { if ((photoresistors[p]) < THRESHOLD) counter=counter++; // } //send_data(counter) wait(.2); } }