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.
Dependencies: Servo mbed biquadFilter
Diff: main.cpp
- Revision:
- 1:93a041e62d7e
- Parent:
- 0:98ae3feb778c
- Child:
- 2:80d4ea87a2bb
- Child:
- 3:aacea1875b7a
--- a/main.cpp Mon Oct 08 10:46:03 2018 +0000
+++ b/main.cpp Mon Oct 08 12:59:46 2018 +0000
@@ -2,17 +2,55 @@
#include "mbed.h"
#include "Servo.h"
-Servo myservo(D1);
+Servo myservo(D7);
+InterruptIn button(PTA4);
+//InterruptIn button1(PTC6);
+//DigitalOut myledgreen(LED_GREEN);
+//DigitalOut myledred(LED_RED);
+
+
+
int main() {
while(1) {
- for(int i=0; i<100; i++) {
- myservo = i/100.0;
- wait(0.01);
+
+ // Met een switch
+
+ switch(button)
+ {
+ case 0:
+ myservo = 0.5;
+ wait(0.01);
+ break;
+
+ default :
+ myservo = 0.0;
+ wait(0.01);
+
}
- for(int i=100; i>0; i--) {
- myservo = i/100.0;
- wait(0.01);
+
+
+
+ // Met een if-loop
+ /*
+ if (button == 0){
+ myledgreen = 0;
+ myledred = 1;
+
+ myservo = 50/100.0;
+ wait(0.01);
+
+ myledgreen = 0;
+ myledred = 1;
+ }
+ else if (button1 == 0){
+ myservo = 0.001;
+ myledgreen = 1;
+ myledred = 0;
}
- }
-}
\ No newline at end of file
+ */
+
+}
+ }
+
+
\ No newline at end of file