
LAB09 Oppgave2 Template
Dependencies: mbed
Import program
00001 #include "mbed.h" 00002 00003 InterruptIn userButton(PC_13); 00004 DigitalOut userLed(PA_5); 00005 00006 DigitalOut Vcc(PA_0); 00007 AnalogIn aInn(PA_1); 00008 DigitalOut Gnd(PA_4); 00009 00010 PwmOut servoMotor(PA_7); 00011 DigitalOut direction(PA_6); 00012 00013 void pressed() 00014 { 00015 userLed=!userLed; // Toogle user led 00016 direction=!direction; // Change motor direction 00017 } 00018 00019 int main() 00020 { 00021 userButton.fall(&pressed); 00022 servoMotor.period(.01); 00023 00024 Vcc=1; 00025 Gnd=0; 00026 00027 while(1) { 00028 servoMotor=aInn.read(); 00029 } 00030 00031 }
Revision 0:8f25416dc51e, committed 2015-10-27
- Comitter:
- rlanghbv
- Date:
- Tue Oct 27 19:02:10 2015 +0000
- Commit message:
- first commit
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /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(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 27 19:02:10 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file