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
Fork of BD1020HFV_Hello by
main.cpp
00001 #include "mbed.h" 00002 00003 Serial pc(USBTX, USBRX); 00004 AnalogIn sensorout(A0); 00005 DigitalOut enablesensor(A1); 00006 00007 void ml8511_print_one_value(){ 00008 float uvraw, uv; 00009 #define MIN (0.300) 00010 #define MAX (0.900) 00011 #define UVONMAX 15 00012 uvraw = sensorout; 00013 uv = ( (UVONMAX/(MAX-MIN)) * (uvraw - MIN) ); 00014 pc.printf("UV Intensity %2.2fmW/cm^2 (raw[%2.3f])\r\n", uv, uvraw); 00015 } 00016 00017 int main() { 00018 pc.printf("\n\r"); 00019 pc.printf("ML8511 UV sensor test program.\n\r"); 00020 pc.printf("Reported UV intensity values are rough approximates.\n\r"); 00021 pc.printf("Please refer to specification page 4 for UV intensity characteristics.\n\r"); 00022 enablesensor = 1; 00023 wait_ms(1); 00024 00025 while(1) { 00026 ml8511_print_one_value(); 00027 wait(0.4); 00028 } 00029 }
Generated on Fri Jul 22 2022 00:57:38 by
1.7.2
