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: ATParser TSL2561 mbed
Fork of Lab10 by
Revision 6:fb1a4c235357, committed 2018-04-24
- Comitter:
- youngs2
- Date:
- Tue Apr 24 22:51:44 2018 +0000
- Parent:
- 5:3b7d8eb3cf35
- Commit message:
- added sleep when not connecting or taking data
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Apr 24 14:46:13 2018 +0000 +++ b/main.cpp Tue Apr 24 22:51:44 2018 +0000 @@ -17,7 +17,8 @@ void sendit() -{ +{ + int sleepvar = 1; float lightnum = lightsensor.lux(); pc.printf("light = %.5f\n\r", lightnum); day[i] = new char[8]; @@ -42,7 +43,8 @@ { free(day[j]); } - } + } + sleepvar = 0; } void connect() @@ -78,8 +80,8 @@ Teddy = 0; connect(); flipper.attach(&sendit, 10); - while(1) + while(sleepvar == 0) { - wait(420); + sleep(); } }