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
common.cpp
- Committer:
- pathfindr
- Date:
- 2018-12-15
- Revision:
- 9:b0a1535b8ef2
- Parent:
- 7:e9a19750700d
- Child:
- 33:760005331b4c
File content as of revision 9:b0a1535b8ef2:
#include "common.h"
//------------------------------------------------------------------------------
// LED
//------------------------------------------------------------------------------
DigitalOut led1(PN_LED);
void LED1on(long milliseconds = 0) {
led1 = 0;
if (milliseconds > 0) {
//ThisThread::sleep_for(milliseconds);
Thread::wait(milliseconds);
led1 = 1;
}
}
void LED1blink(int count = 2, long milliseconds = 100) {
for (int i = 0; i < (count*2); i++) {
led1 = !led1;
if (milliseconds > 0) {
Thread::wait(milliseconds);
//ThisThread::sleep_for(milliseconds);
} else {
Thread::wait(100);
//ThisThread::sleep_for(100); //default if 0 provided
}
}
led1 = 1;
}
void LED1off() {
led1 = 1;
}