Peter Knoben
/
Servo_control
Servo controller
Revision 0:1810c6beabf5, committed 2017-10-20
- Comitter:
- peterknoben
- Date:
- Fri Oct 20 09:34:24 2017 +0000
- Commit message:
- Servo controller
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Fri Oct 20 09:34:24 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/Servo/#36b69a7ced07
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Oct 20 09:34:24 2017 +0000 @@ -0,0 +1,35 @@ +#include "mbed.h" +#include "Servo.h" + +//------------------------------------------------------------------------------ +//------------------------------Servo Setup------------------------------------- +//------------------------------------------------------------------------------ + +Servo MyServo(D9); +InterruptIn But1(PTA4); +int k=0; + +//------------------------------------------------------------------------------ +//---------------------------Servo Controller----------------------------------- +//------------------------------------------------------------------------------ + +void servo_control (){ + if (k==0){ + MyServo = 0; + k=1; + } + else{ + MyServo = 2; + k=0; + } +} + +//------------------------------------------------------------------------------ +//-------------------------------Main Loop-------------------------------------- +//------------------------------------------------------------------------------ + +int main() +{ + But1.rise(&servo_control); + while (1) {} +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Oct 20 09:34:24 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/b484a57bc302 \ No newline at end of file