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.
main.cpp
- Committer:
- Iadri
- Date:
- 2016-01-26
- Revision:
- 3:01f6b6659073
- Parent:
- 2:6cb4b93e2b74
File content as of revision 3:01f6b6659073:
#include "mbed.h" //Serial pc(USBTX, USBRX); AnalogIn photores(A0); DigitalIn button(SW2); DigitalOut IRled(D7); DigitalOut PiSign(D6); DigitalOut ledred(LED_RED); DigitalIn PiRead(D5); Ticker StorageChecker; const double ticktime = 2; double light; double pi; void StorageCheck() { IRled = 1; wait_us(100); light = photores; pi = PiRead; if(light >= 0.15) { ledred = 0; PiSign = 1; } else { ledred = 1; PiSign = 0; } } int main() { //pc.baud(9600); ledred = 1; StorageChecker.attach(&StorageCheck, ticktime); while (true) { IRled = 0; sleep(); } }