![](/media/cache/group/MFR16-new.png.50x50_q85.jpg)
Sweep a servo according to Proximity sensor measure
Dependencies: Servo X_NUCLEO_6180XA1 mbed
Fork of HelloWorld_6180XA1 by
Revision 46:43aef8f6e9a0, committed 2016-10-06
- Comitter:
- mfr16
- Date:
- Thu Oct 06 10:50:15 2016 +0000
- Parent:
- 45:97f6ac8f2bb1
- Commit message:
- Example to sweep a servo according to Proximity sensor measure
;
Changed in this revision
Servo.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Thu Oct 06 10:50:15 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/Servo/#36b69a7ced07
--- a/main.cpp Tue Sep 27 15:22:33 2016 +0000 +++ b/main.cpp Thu Oct 06 10:50:15 2016 +0000 @@ -5,6 +5,10 @@ #include <stdio.h> #include <assert.h> +#include "Servo.h" + +Servo myservo(D3); + /* This VL6180X Expansion board test application performs a range measurement and als measurement in polling mode on the onboard embedded top sensor. The result of both the measures are printed on the serial over. @@ -34,6 +38,7 @@ { board->sensor_top->GetDistance(&dist); board->sensor_top->GetLux(&lux); + myservo = (255.0-dist)/255.0; printf ("Distance: %d, Lux: %d\n\r",dist, lux); } }