UV index meter

Dependencies:   AQM0802 mbed

See http://developer.mbed.org/users/yasuyuki/notebook/UVindex/

Files at this revision

API Documentation at this revision

Comitter:
yasuyuki
Date:
Wed Oct 08 02:40:33 2014 +0000
Commit message:
first release

Changed in this revision

AQM0802.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r cdf856d3c0b7 AQM0802.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AQM0802.lib	Wed Oct 08 02:40:33 2014 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/yasuyuki/code/AQM0802/#6fa303916aa8
diff -r 000000000000 -r cdf856d3c0b7 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 08 02:40:33 2014 +0000
@@ -0,0 +1,69 @@
+//**********************
+// UV index meter for mbed with ML8511
+//
+// UV index
+// Extreme 11+
+// Very High 8-10
+// High 6-7
+// Moderate 3-5
+// Low 0-2
+//
+// LPC1768 flash=512KB, ADC=12bits
+// LPC11U35 flash=64KB, ADC=10bits
+// Nucleo ADC=12bits
+//
+// (C)Copyright 2014 All rights reserved by Y.Onodera
+// http://einstlab.web.fc2.com
+//**********************
+#include "mbed.h"
+#include "AQM0802.h"
+
+//#pragma O0
+//#pragma O1
+//#pragma O2    // default
+//#pragma O3
+//#pragma Otime
+//#pragma Ospace
+
+
+#if defined(TARGET_LPC1768)
+I2C i2c(p28,p27);
+AnalogIn ain(p15);
+#endif
+// for TG-LPC11U35-501
+#if defined(TARGET_LPC11U35_501)
+I2C i2c(P0_5,P0_4);
+AnalogIn ain(P0_11);
+#endif
+// for Nucleo
+#if defined(TARGET_NUCLEO_F401RE)
+I2C i2c(D14,D15);
+AnalogIn ain(PA_0);
+#endif
+
+AQM0802 lcd(i2c);
+
+int main() {
+    
+    char msg[10];
+    float UV;
+
+    sprintf(msg, "UV index");
+    lcd.locate(0,0);
+    lcd.print(msg);
+      
+    while(1) {
+
+        // UV index
+        // 1V=0
+        // 2V=10
+        UV = (ain.read()*3.3-1.0)/(2.0-1.0)*10.0;
+
+        sprintf(msg,"%4.1f",UV);
+        lcd.locate(0,1);
+        lcd.print(msg);
+        wait(1);
+    }
+
+}
+
diff -r 000000000000 -r cdf856d3c0b7 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 08 02:40:33 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file