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.
Diff: main.cpp
- Revision:
- 0:59989a20267b
diff -r 000000000000 -r 59989a20267b main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Apr 09 00:22:55 2022 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+
+InterruptIn aphase(D0);
+InterruptIn bphase(D1);
+DigitalOut led1(D2);
+DigitalOut led2(D3);
+void elses();
+void interrupt();
+int a=0;
+int b=0;
+
+int main(){
+ aphase.fall(&elses);
+ aphase.rise(&interrupt);
+ bphase.fall(&elses);
+ bphase.rise(&interrupt);
+
+ while(1) {
+ }
+}
+
+void interrupt(){
+ b=b-1;
+ a=a+1;
+ if((b==b-1)||(a=a+1)){
+ led1=!led1;
+ b=b+1;
+ a=a-1;
+
+ }
+ }
+
+void elses(){
+ b=b+1;
+ a=a-1;
+ led2=!led2;
+ }
+
+