Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:eb4e1282a821, committed 2018-10-30
- Comitter:
- dantg
- Date:
- Tue Oct 30 12:54:24 2018 +0000
- Commit message:
- Servo with Sensor;
Changed in this revision
diff -r 000000000000 -r eb4e1282a821 Servo.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Tue Oct 30 12:54:24 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/simon/code/Servo/#36b69a7ced07
diff -r 000000000000 -r eb4e1282a821 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 30 12:54:24 2018 +0000 @@ -0,0 +1,33 @@ +#include "mbed.h" +#include "Servo.h" + +Serial pc(USBTX, USBRX); // USB serial interface +Servo my_srv(p21); // continuous rotation hobby servo +DigitalIn snsr30(p17); +DigitalIn snsr150(p18); +#define CR_SCALE 12.0 +int main() { + // set the USB serial interface baud rate + pc.baud(921600); + + my_srv.calibrate(0.001,45); + while(1) { + if(snsr30 > 0.8) { + my_srv.write(0.1666666); + } + wait(0.5); + else { + my_srv.write(0.5); + } + wait(0.5); + if(snsr150 > 0.8) { + my_srv.write(0.8333333); + } + wait(0.5); + else { + my_srv.write(0.5); + } + wait(0.5); + } +} +
diff -r 000000000000 -r eb4e1282a821 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 30 12:54:24 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file