资源简介
程序下载即用,如遇光照强度过高可自行在模块外表添加菲涅尔透镜,可降低直射光照的影响。

代码片段和文件信息
/*
SFE_TSL2561 illumination sensor library for Arduino
Mike Grusin SparkFun Electronics
This library provides functions to access the TAOS TSL2561
Illumination Sensor.
Our example code uses the “beerware“ license. You can do anything
you like with this code. No really anything. If you find it useful
buy me a beer someday.
version 1.0 2013/09/20 MDG initial version
*/
#include
#include
SFE_TSL2561::SFE_TSL2561(void)
// SFE_TSL2561 object
{}
boolean SFE_TSL2561::begin(void)
// Initialize TSL2561 library with default address (0x39)
// Always returns true
{
return(begin(TSL2561_ADDR));
}
boolean SFE_TSL2561::begin(char i2c_address)
// Initialize TSL2561 library to arbitrary address or:
// TSL2561_ADDR_0 (0x29 address with ‘0‘ shorted on board)
// TSL2561_ADDR (0x39 default address)
// TSL2561_ADDR_1 (0x49 address with ‘1‘ shorted on board)
// Always returns true
{
_i2c_address = i2c_address;
Wire.begin();
return(true);
}
boolean SFE_TSL2561::setPowerUp(void)
// Turn on TSL2561 begin integrations
// Returns true (1) if successful false (0) if there was an I2C error
// (Also see getError() below)
{
// Write 0x03 to command byte (power on)
return(writeByte(TSL2561_REG_CONTROL0x03));
}
boolean SFE_TSL2561::setPowerDown(void)
// Turn off TSL2561
// Returns true (1) if successful false (0) if there was an I2C error
// (Also see getError() below)
{
// Clear command byte (power off)
return(writeByte(TSL2561_REG_CONTROL0x00));
}
boolean SFE_TSL2561::setTiming(boolean gain unsigned char time)
// If gain = false (0) device is set to low gain (1X)
// If gain = high (1) device is set to high gain (16X)
// If time = 0 integration will be 13.7ms
// If time = 1 integration will be 101ms
// If time = 2 integration will be 402ms
// If time = 3 use manual start / stop
// Returns true (1) if successful false (0) if there was an I2C error
// (Also see getError() below)
{
unsigned char timing;
// Get timing byte
if (readByte(TSL2561_REG_TIMINGtiming))
{
// Set gain (0 or 1)
if (gain)
timing |= 0x10;
else
timing &= ~0x10;
// Set integration time (0 to 3)
timing &= ~0x03;
timing |= (time & 0x03);
// Write modified timing byte back to device
if (writeByte(TSL2561_REG_TIMINGtiming))
return(true);
}
return(false);
}
boolean SFE_TSL2561::setTiming(boolean gain unsigned char time unsigned int &ms)
// If gain = false (0) device is set to low gain (1X)
// If gain = high (1) device is set to high gain (16X)
// If time = 0 integration will be 13.7ms
// If time = 1 integration will be 101ms
// If time = 2 integration will be 402ms
// If time = 3 use manual start / stop (ms = 0)
// ms will be set to integration time
// Returns true (1) if successful false (0) if there was an I2C error
// (Also see getError() below)
{
// Calculate ms for user
switch (time)
{
case 0: ms = 14; break;
case 1: ms = 101; break;
case 2: ms = 402;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-03-11 01:15 GY2561\
目录 0 2014-08-11 21:50 GY2561\arduino code\
目录 0 2014-08-11 21:50 GY2561\arduino code\SFE_TSL2561\
目录 0 2014-08-11 21:50 GY2561\arduino code\SFE_TSL2561\examples\
目录 0 2014-08-11 21:50 GY2561\arduino code\SFE_TSL2561\examples\SFE_TSL2561_example\
文件 6467 2013-12-27 14:34 GY2561\arduino code\SFE_TSL2561\examples\SFE_TSL2561_example\SFE_TSL2561_example.ino
文件 550 2013-12-27 14:34 GY2561\arduino code\SFE_TSL2561\keywords.txt
文件 10985 2013-12-27 14:34 GY2561\arduino code\SFE_TSL2561\SFE_TSL2561.cpp
文件 7155 2013-12-27 14:34 GY2561\arduino code\SFE_TSL2561\SFE_TSL2561.h
文件 427750 2014-08-04 15:10 GY2561\GY2561-1.JPG
文件 47175 2014-08-11 21:48 GY2561\GY2561_sch.JPG
文件 858830 2018-03-11 01:14 GY2561\TSL2561.en.zh-CN.pdf
文件 432570 2014-06-21 11:51 GY2561\TSL2561.pdf
目录 0 2018-03-11 00:37 实验23 IIC实验\
目录 0 2018-03-11 00:37 实验23 IIC实验\CORE\
文件 17273 2010-06-07 10:25 实验23 IIC实验\CORE\core_cm3.c
文件 85714 2011-02-09 14:59 实验23 IIC实验\CORE\core_cm3.h
文件 15503 2011-03-10 10:52 实验23 IIC实验\CORE\startup_stm32f10x_hd.s
目录 0 2018-03-11 22:48 实验23 IIC实验\HARDWARE\
目录 0 2018-03-12 19:12 实验23 IIC实验\HARDWARE\IIC\
文件 3071 2018-03-12 19:12 实验23 IIC实验\HARDWARE\IIC\myiic.c
文件 1354 2015-04-29 11:46 实验23 IIC实验\HARDWARE\IIC\myiic.h
目录 0 2018-03-11 00:37 实验23 IIC实验\HARDWARE\KEY\
文件 1827 2015-03-20 12:41 实验23 IIC实验\HARDWARE\KEY\key.c
文件 1186 2015-03-19 16:14 实验23 IIC实验\HARDWARE\KEY\key.h
目录 0 2018-03-11 00:37 实验23 IIC实验\HARDWARE\LCD\
文件 35016 2015-03-13 14:54 实验23 IIC实验\HARDWARE\LCD\font.h
文件 85363 2015-04-24 11:50 实验23 IIC实验\HARDWARE\LCD\lcd.c
文件 7529 2015-04-24 11:48 实验23 IIC实验\HARDWARE\LCD\lcd.h
目录 0 2018-03-11 00:37 实验23 IIC实验\HARDWARE\LED\
文件 1298 2012-09-13 13:13 实验23 IIC实验\HARDWARE\LED\led.c
............此处省略163个文件信息
- 上一篇:安信可ESP8266安卓手机测试软件
- 下一篇:Spark快速大数据分析—中文版
相关资源
- stm32f407上的两个can发送和接收例程
- STM32 led 时钟
- STM32 2.4G通信例程
- 直流无刷电机方波驱动 stm32 例程代码
- STM32中文资料
- STM32蓝牙和串口程序
- STM32f103超声波模块例程
- stm32f103c8t6 4 oled.rar
- stm32f030 IAP Demo(原创)
- STM32基于rt_thread操作系统的SDHC卡文件
- NRF24L01实现51与STM32双向通讯
- STM32F103 串口程序(完整版)
- stm32 ds18b20 温度传感器 测试通过
- stm32官方例程
- STM32F103定时器中断程序
- [免费]基于stm32f103ze 的OLED驱动代码
- STM32F103RBT6驱动UC1698控制芯片的160160黑
- STM32F103 DS18B20 V3.5.0固件库驱动程序工
- STM32定时器使用入门。看了这个程序会
- SIM908 SDIO FSMC STM32 FIFO
- STM32F103 CC2500完整驱动(模拟SPI)
- AD7606采集程序
- stm32 用SPI 方式读写 SDHC
- stm32通过DMA方式采集ADC数据
- 意法半导体STM全系列微控制器STM32ST
- 基于STM32芯片的SX1278 驱动 LORA.rar
- STM32的PCB封装库,以及原理图库,48
- SX1280.rar
- STM32 DS3231驱动.zip
- STM32F103C8T6+NRF24l01无线通信
评论
共有 条评论