Grove UVsensor program

Dependencies:   mbed

Connection

Vcc → 3.0V ~ 5.1V (supply voltage)

GND → GND

SIG → p15 (mbed AnalogIn)

NC → Non connection

Files at this revision

API Documentation at this revision

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);
     }
 }