当前位置:网站首页>CoCube显示测试笔记
CoCube显示测试笔记
2022-08-08 06:29:00 【zhangrelay】
数字量LED显示案例:

cocube测试led刷新
代码如下:
for(DELAYVAL=1;DELAYVAL<10;DELAYVAL++)
{
// The first NeoPixel in a strand is #0, second is 1, all the way up
// to the count of pixels minus one.
for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
pixels.setPixelColor(i, pixels.Color(1, 0, 0));
pixels.show(); // Send the updated pixel colors to the hardware.
delay(DELAYVAL); // Pause before next pass through loop
}
for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
pixels.setPixelColor(i, pixels.Color(0, 1, 0));
pixels.show(); // Send the updated pixel colors to the hardware.
delay(DELAYVAL); // Pause before next pass through loop
}
for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
pixels.setPixelColor(i, pixels.Color(0, 0, 1));
pixels.show(); // Send the updated pixel colors to the hardware.
delay(DELAYVAL); // Pause before next pass through loop
}
for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
pixels.setPixelColor(i, pixels.Color(1, 1, 0));
pixels.show(); // Send the updated pixel colors to the hardware.
delay(DELAYVAL); // Pause before next pass through loop
}
for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
pixels.setPixelColor(i, pixels.Color(0, 1, 1));
pixels.show(); // Send the updated pixel colors to the hardware.
delay(DELAYVAL); // Pause before next pass through loop
}
for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
pixels.setPixelColor(i, pixels.Color(1, 0, 1));
pixels.show(); // Send the updated pixel colors to the hardware.
delay(DELAYVAL); // Pause before next pass through loop
}
for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
pixels.setPixelColor(i, pixels.Color(1, 1, 1));
pixels.show(); // Send the updated pixel colors to the hardware.
delay(DELAYVAL); // Pause before next pass through loop
}
}注释为原版程序,未作修改。
简单解释一下:
// NeoPixel Ring 简单草图 (c) 2013 Shae Erisson
// 在 GPLv3 许可下发布以匹配其余的
// Adafruit NeoPixel 库
参考:Adafruit_NeoPixel
// 在设置 NeoPixel 库时,设置有多少像素,
// 以及使用哪个引脚发送信号。 请注意,对于旧版 NeoPixel
// 删除可能需要更改的第三个参数——参见
// strandtest 示例以获取有关可能值的更多信息。
NUMPIXELS是LED数量,8*8一共64个。
DELAYVAL是刷新时延,1ms-9ms。
pixels.setPixelColor(i, pixels.Color(1, 0, 0));
分别为RGB颜色显示。
pixels.Color(1, 0, 0) 红色亮度1
pixels.Color(0, 1, 0) 绿色亮度1
pixels.Color(0, 0, 1) 蓝色亮度1
pixels.Color(255, 0, 0) 红色亮度255
pixels.Color(0, 255, 0) 绿色亮度255
pixels.Color(0, 0, 255) 蓝色亮度255
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
边栏推荐
- 物联网安全系列 - 非对称加密算法 ECDH
- 动手学概率论(2)
- 网络安全笔记第二天day2(等级保护)
- throw 和 throws 有什么区别
- Detection of transcription factors binding to methylatedDNA by deep recurrent neural network
- 每日一题day44-45-46
- golang 服务诡异499、504网络故障排查
- Deep-4mCGP:一种使用基于相关性的特征选择技术预测pickeringii地杆菌中4mC位点的深度学习方法
- Day37------网络
- Solved the problem that when VRTK transmission under Unity HDRP, the screen fades in and out, and the visual occlusion cannot be displayed correctly when passing through the wall
猜你喜欢
随机推荐
请问ots表有点大,现在是通过外表查询的除了用sql还有其他方法优化嘛?
动手学线性代数
BLE安全之配对流程剖析(2)
日常用到的开源软件列表
排序,欸嘿,排序
在字符串中查找子字符串
受邀全球互联网技术大会分享
单片机裸机编程中实用驱动分享
快速排序
论文解读:《Mouse4mC-BGRU:用于预测小鼠基因组中DNA N4-甲基胞嘧啶位点的深度学习》
使用websocket实现服务端主动发送消息到客户端
“重载”与“重写”的区别
每日一题day44-45-46
使用Jlink RTT工具打印日志
Golang 简单的读负载均衡
webAPI
PHR-search:一个基于预测蛋白质层次关系的蛋白质远程同源性检测搜索框
C# FileSystemWatcher 实时监控文件的增加、修改、重命名和删除实例
【服务器运维】忘记XShell 服务器口令
小程序云开发服务端(云函数-函数式编程)数据库取出数据突破限制









