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: mbed
main.cpp
- Committer:
- akashlal
- Date:
- 2016-07-07
- Revision:
- 1:c2e1412f8efe
- Parent:
- 0:060c8e380e75
File content as of revision 1:c2e1412f8efe:
#include "mbed.h" //Hysterisis thresholds are 0.2 and 0.4 AnalogIn ldr(PTB1); DigitalOut led(PTD1); Serial pc(USBTX,USBRX); int main() { float i; int ldrval, ledval; while(1) { ldrval=ldr.read()*1000; i=ldr.read(); if(i>=0.4) { led=0; ledval=1000; } if(i<=0.2) { led=1; ledval=10; } pc.printf("$%d %d;",ldrval,ledval); } }