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@9:b0a1535b8ef2, 2018-12-15 (annotated)
- Committer:
- pathfindr
- Date:
- Sat Dec 15 13:45:28 2018 +0000
- Revision:
- 9:b0a1535b8ef2
- Parent:
- 7:e9a19750700d
- Child:
- 33:760005331b4c
sat
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| pathfindr | 7:e9a19750700d | 1 | #include "common.h" | 
| pathfindr | 7:e9a19750700d | 2 | |
| pathfindr | 7:e9a19750700d | 3 | //------------------------------------------------------------------------------ | 
| pathfindr | 7:e9a19750700d | 4 | // LED | 
| pathfindr | 7:e9a19750700d | 5 | //------------------------------------------------------------------------------ | 
| pathfindr | 7:e9a19750700d | 6 | DigitalOut led1(PN_LED); | 
| pathfindr | 7:e9a19750700d | 7 | |
| pathfindr | 7:e9a19750700d | 8 | void LED1on(long milliseconds = 0) { | 
| pathfindr | 7:e9a19750700d | 9 | led1 = 0; | 
| pathfindr | 7:e9a19750700d | 10 | if (milliseconds > 0) { | 
| pathfindr | 9:b0a1535b8ef2 | 11 | //ThisThread::sleep_for(milliseconds); | 
| pathfindr | 9:b0a1535b8ef2 | 12 | Thread::wait(milliseconds); | 
| pathfindr | 7:e9a19750700d | 13 | led1 = 1; | 
| pathfindr | 7:e9a19750700d | 14 | } | 
| pathfindr | 7:e9a19750700d | 15 | } | 
| pathfindr | 7:e9a19750700d | 16 | void LED1blink(int count = 2, long milliseconds = 100) { | 
| pathfindr | 7:e9a19750700d | 17 | for (int i = 0; i < (count*2); i++) { | 
| pathfindr | 7:e9a19750700d | 18 | led1 = !led1; | 
| pathfindr | 7:e9a19750700d | 19 | if (milliseconds > 0) { | 
| pathfindr | 9:b0a1535b8ef2 | 20 | Thread::wait(milliseconds); | 
| pathfindr | 9:b0a1535b8ef2 | 21 | //ThisThread::sleep_for(milliseconds); | 
| pathfindr | 7:e9a19750700d | 22 | } else { | 
| pathfindr | 9:b0a1535b8ef2 | 23 | Thread::wait(100); | 
| pathfindr | 9:b0a1535b8ef2 | 24 | //ThisThread::sleep_for(100); //default if 0 provided | 
| pathfindr | 7:e9a19750700d | 25 | } | 
| pathfindr | 7:e9a19750700d | 26 | } | 
| pathfindr | 7:e9a19750700d | 27 | led1 = 1; | 
| pathfindr | 7:e9a19750700d | 28 | } | 
| pathfindr | 7:e9a19750700d | 29 | void LED1off() { | 
| pathfindr | 7:e9a19750700d | 30 | led1 = 1; | 
| pathfindr | 7:e9a19750700d | 31 | } |