Grove UVsensor program
Connection
Vcc → 3.0V ~ 5.1V (supply voltage)
GND → GND
SIG → p15 (mbed AnalogIn)
NC → Non connection
Revision 1:d583c567fcfe, committed 2019-11-06
- Comitter:
- HeptaSatTraining2019
- Date:
- Wed Nov 06 18:14:21 2019 +0000
- Parent:
- 0:26a3a6edbb11
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Sep 05 03:00:54 2014 +0000 +++ b/main.cpp Wed Nov 06 18:14:21 2019 +0000 @@ -1,12 +1,10 @@ #include "mbed.h" - -AnalogIn sensorUV(A0); - +AnalogIn sensorUV(p15); +float UVvalue; int main() { - float value; while (true) { - value = sensorUV; - printf("\rUV Value = %3.2f%%",value*100); - wait(.1); + UVvalue = sensorUV; + printf("\rUV Value = %3.2f%%\r\n",UVvalue*100); + wait(1.0); } }