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:61da65a6f0b3
diff -r 000000000000 -r 61da65a6f0b3 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Aug 18 14:11:53 2018 +0000
@@ -0,0 +1,26 @@
+#include "MicroBit.h"
+
+MicroBit uBit;
+
+int main(){
+ uBit.init();
+ while (1){
+ uBit.io.P1.setDigitalValue(1);
+ uBit.io.P0.setDigitalValue(0);
+ for(int i=0; i<=1023; i=i+20){
+ uBit.io.P2.setAnalogValue(i);
+ uBit.sleep(200);
+ }
+ uBit.io.P1.setDigitalValue(0);
+ uBit.sleep(500);
+ uBit.io.P0.setDigitalValue(1);
+ for(int i=1023; i>=0; i=i-20){
+ uBit.io.P2.setAnalogValue(i);
+ uBit.sleep(200);
+ }
+ uBit.io.P0.setDigitalValue(0);
+ uBit.sleep(500);
+ }
+}
+
+