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.
main.cpp
00001 #include "mbed.h" 00002 #include "Si1133.h " 00003 00004 //I2C i2c (p13, p15); 00005 //Create an Si1133 object 00006 Si1133 sensor(P0_13, P0_15); 00007 //Serial pc(p25, p26); 00008 00009 int main() 00010 { 00011 00012 //Try to open the Si1133 00013 if (sensor.open()) { 00014 printf("Device detected!\n"); 00015 while (1) { 00016 //Print the current light level 00017 printf("Lux = %.3f\n", (float)sensor.get_light_level()); 00018 //Print the current UV index 00019 printf("UV index = %.3f\n", (float)sensor.get_uv_index()); 00020 //Sleep for 0.5 seconds 00021 wait(0.5); 00022 } 00023 } else { 00024 error("Device not detected!\n"); 00025 } 00026 }
Generated on Sun Jul 24 2022 19:56:57 by
1.7.2