kevin ANTUNES
/
megotkevin
projet megot
Fork of Servo_HelloWorld by
main.cpp
- Committer:
- Kevin_16
- Date:
- 2017-05-10
- Revision:
- 2:d9a738c0e226
- Parent:
- 1:40d2fd0b99e6
File content as of revision 2:d9a738c0e226:
// Hello World to sweep a servo through its full range #include "mbed.h" #include "Servo.h" // init pin for Nucleo-L476RG // Servo myservo(PB_3); // init pin for Nucleo-L432KC Servo myservo(D6); AnalogIn ain (A2); int main() { float p = 0.0; float pRead; // myservo.position(0); while(1){ /*myservo.write(0); wait(5); myservo.write(1); wait(5);*/ //myservo.position(90); //myservo.write(p); //pRead = myservo.read(); // printf("val = %f \n",pRead); //wait(0.8); /*if(p > 0.9) p=0.0; else p+=0.1;*/ if (ain == 1) { myservo.write(1); // myservo.position(180); wait(2); // myservo.position(0); myservo.write(0); } } }