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: aconno_I2C Lis2dh12 WatchdogTimer
Diff: common.cpp
- Revision:
- 7:e9a19750700d
- Child:
- 9:b0a1535b8ef2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common.cpp Tue Dec 11 22:18:24 2018 +0000
@@ -0,0 +1,28 @@
+#include "common.h"
+
+//------------------------------------------------------------------------------
+// LED
+//------------------------------------------------------------------------------
+DigitalOut led1(PN_LED);
+
+void LED1on(long milliseconds = 0) {
+ led1 = 0;
+ if (milliseconds > 0) {
+ ThisThread::sleep_for(milliseconds);
+ led1 = 1;
+ }
+}
+void LED1blink(int count = 2, long milliseconds = 100) {
+ for (int i = 0; i < (count*2); i++) {
+ led1 = !led1;
+ if (milliseconds > 0) {
+ ThisThread::sleep_for(milliseconds);
+ } else {
+ ThisThread::sleep_for(100); //default if 0 provided
+ }
+ }
+ led1 = 1;
+}
+void LED1off() {
+ led1 = 1;
+}
\ No newline at end of file