当前位置:网站首页>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
边栏推荐
- Day38------网络相关
- 代码学习过程梳理
- DCNN-4mC: Densely connected neural network basedN4-methylcytosine site prediction in multiple speci
- golang 服务平滑重启小结
- 论文解读:《PST-PRNA:使用蛋白质表面地形和深度学习对RNA结合位点的预测》
- 动手学概率论(2)
- Excel文件解析
- seata什么时候支持sqlserver xa呀?
- List、Set、Map、Queue、Deque、Stack遍历方式小结
- Problem solving about Unity's button event response error triggering UI events
猜你喜欢
【Excel】csv文件修改分隔符
BLE安全之配对流程剖析(2)
DCNN-4mC: Densely connected neural network basedN4-methylcytosine site prediction in multiple speci
ctP2ISP:使用卷积和数据增强的转换器预测蛋白质-蛋白质相互作用位点
物联网安全-单向散列算法
【Android安全】Oneplus 5T root 刷机 救砖
一文带你了解webrtc基本原理(动手实现1v1视频通话)
基于FTP协议的文件上传与下载
Monorepo[单一代码库] 与MicroService[微服务] 架构
动手学数理统计(1)
随机推荐
蓝牙5.2新特性 - Enhance ATT
JVM类加载的过程
不一样的“能ping通不能上网”解决方法
快速排序
Zip文件的解析与生成
论文解读:iDRNA-ITF:基于诱导和转移框架识别蛋白质中的DNA和RNA结合残基
Redis(4)-Redis遇到的问题
在String类型的前提前下:使用“==“ 与equals的区别
基于FTP协议的文件上传与下载
DCNN-4mC: Densely connected neural network basedN4-methylcytosine site prediction in multiple speci
自动化测试------selenium
golang 服务诡异499、504网络故障排查
Task04:PyTorch生态简介
每日一题Day40-41
论文解读:《4mcPred-CNN—使用卷积神经网络预测小鼠基因组中的DNA N4-甲基胞嘧啶》
闭包函数和装饰器
论文翻译:《Phosvardeep:使用序列信息对磷酸变化的深度学习预测》
字符串常见方法
论文解读:《EMDLP:RNA甲基化位点预测的合奏多尺度深度学习模型》
Adapt-Kcr:基于学习嵌入特征和注意力架构的新型深度学习框架,用于精确预测赖氨酸(crotonylation)位点