limit switch example

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
glintligo
Date:
Tue Jul 17 00:51:06 2018 +0000
Parent:
1:fe798c459fdb
Commit message:
beta2

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Jul 17 00:29:53 2018 +0000
+++ b/main.cpp	Tue Jul 17 00:51:06 2018 +0000
@@ -1,15 +1,17 @@
 #include "mbed.h"
 
-PwmOut mypwm(PA_10);
+PwmOut mypwm0(PB_0);
+PwmOut mypwm1(PB_1);
 InterruptIn button(PB_3);
 DigitalOut myled(LED1);
 void stop();
 
 int main() {
-    button.rise(&stop);
-    mypwm.period_ms(10);
-    mypwm.pulsewidth_ms(9);
-    
+  //  button.rise(&stop);
+    mypwm0.period_ms(10);
+    mypwm0.pulsewidth_ms(8);
+    mypwm1.period_ms(10);
+    mypwm1.pulsewidth_ms(0);
     while(1) {
         myled = !myled;
         wait(1);
@@ -19,7 +21,8 @@
 void stop()
 {   wait(0.01);
     if(button.read() == 1){
-    mypwm.write(0); 
+    mypwm0.write(0); 
+    mypwm1.write(0);
     }  
 }