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.
Diff: main.cpp
- Revision:
- 0:46b2c955924b
- Child:
- 1:279fcab0c394
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 08 18:17:55 2018 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" +AnalogIn lightSensor(p20); +Serial pc(USBTX,USBRX); +int main() { + float x; + int n = 10; + while(1) { + // Average n readings of the light sensor + x = 0; + for (int i = 0; i<n; i++) + x = x + lightSensor; + x = x/n; + pc.printf("%.4f\r\n", x); + wait(0.2); + } +} \ No newline at end of file