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.
VEML6070.cpp
00001 /*************************************************** 00002 This is a library for the VEML6070 UV-A Sensor 00003 00004 Works with the VEML6070 sensor from Adafruit 00005 ----> https://www.adafruit.com/products/2899 00006 Or knock-off sensors from aliexpress 00007 00008 These sensors use I2C to communicate, 2 pins are required to 00009 interface 00010 00011 06/09/2017 - Initial mbed driver by Scott Roberts 00012 ****************************************************/ 00013 00014 #include "VEML6070.h" 00015 VEML6070::VEML6070 (I2C& p_i2c) : _i2c(p_i2c) 00016 { 00017 00018 } 00019 00020 void VEML6070::begin(veml6070_integrationtime_t itime) 00021 { 00022 _i2c.read((int)0x18,dt,1,false); 00023 dt[0]=((itime << 2) | 0x02); 00024 _i2c.write((int)VEML6070_ADDR_L,dt,2,false); 00025 Thread::wait(500); 00026 } 00027 00028 uint16_t VEML6070::readUV() 00029 { 00030 uint16_t uvi; 00031 _i2c.read(VEML6070_ADDR_H, dt,1); 00032 uvi = dt[0]<<8; 00033 _i2c.read(VEML6070_ADDR_L, dt,1,false); 00034 uvi |= dt[0]; 00035 00036 return uvi; 00037 } 00038
Generated on Thu Jul 14 2022 00:03:36 by
1.7.2