查看Noduino TSL2561的源代码
←
Noduino TSL2561
跳转到:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
== 代码示例 == <source lang=c> #include "noduino.h" #include "tsl2561.h" irom void setup() { serial_begin(115200); if (!tsl2561_begin(TSL2561_ADDR_LOW)) { serial_print("Could not found TSL2561 sensor!\r\n"); while (1) {} } tsl2561_setGain(TSL2561_GAIN_16X); // set 16x gain (for dim situations) // Changing the integration time gives you a longer time over which to sense light // longer timelines are slower, but are good in very low light situtations! tsl2561_setTiming(TSL2561_INTEGRATIONTIME_13MS); // shortest integration time (bright light) } void loop() { // Simple data read example. Just read the infrared, fullspecrtrum diode // or 'visible' (difference between the two) channels. // This can take 13-402 milliseconds! Uncomment whichever of the following you want to read uint16_t x = tsl2561_getLuminosity(TSL2561_VISIBLE); serial_printf("Luminosity:\t %d\r\n", x); // More advanced data read example. Read 32 bits with top 16 bits IR, bottom 16 bits full spectrum // That way you can do whatever math and comparisons you want! uint32_t lum = tsl2561_getFullLuminosity(); uint16_t ir, full; ir = lum >> 16; full = lum & 0xFFFF; serial_printf("IR:\t\t %d\r\n", ir); serial_printf("Full: ", full); serial_printf("Visible:\t %d\r\n", full - ir); serial_printf("Lux:\t\t %d\r\n\n", tsl2561_calculateLux(full, ir)); delay(3000); } </source> <br><br>
返回到
Noduino TSL2561
。
个人工具
登录
名字空间
页面
讨论
变换
查看
阅读
查看源代码
查看历史
操作
搜索
导航
首页
社区专页
新闻动态
最近更改
随机页面
帮助
工具箱
链入页面
相关更改
特殊页面