Morten Madsen
/
LAB09_Oppgave2
LAB09_Oppgave2
Fork of LAB09_Oppgave2 by
Diff: main.cpp
- Revision:
- 0:8f25416dc51e
- Child:
- 1:f0d090bf0578
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 27 19:02:10 2015 +0000 @@ -0,0 +1,31 @@ +#include "mbed.h" + +InterruptIn userButton(PC_13); +DigitalOut userLed(PA_5); + +DigitalOut Vcc(PA_0); +AnalogIn aInn(PA_1); +DigitalOut Gnd(PA_4); + +PwmOut servoMotor(PA_7); +DigitalOut direction(PA_6); + +void pressed() +{ + userLed=!userLed; // Toogle user led + direction=!direction; // Change motor direction +} + +int main() +{ + userButton.fall(&pressed); + servoMotor.period(.01); + + Vcc=1; + Gnd=0; + + while(1) { + servoMotor=aInn.read(); + } + +}