【发布时间】:2016-05-14 15:16:14
【问题描述】:
我正在使用定制的 IRremote 和 SSD1306 库在 Attiny85 上进行编码。
接收 IR 数据时,结果以这种方式存储:
unsigned long value // Decoded value, max 32 bits
volatile unsigned int *rawbuf // Raw interval in 50uS ticks
int rawlen // Number of records in rawbuf
OLED显示屏相关功能有:
void printChar (char ch)
void printString (char* pText)
我正在努力将接收到的 IR 值打印到 OLED SSD1306 屏幕。用户能够查看接收到的代码并将其保存到 EEPROM,因此我尝试了所有不同的转换,但我无法以显示接收到的 HEX 代码的方式将 results.value 打印到屏幕上(例如 0xE0E040BF,即三星电视开机)。
由于 attiny85 中的 Serial 滞后,我不知道如何调试它并使其正常工作。有什么帮助吗?
编辑(添加相关代码):
#include "SSD1306.h"
#include "IRremote.h"
...
if (irrecv.decode(&results)) {
dumpCode(&results);
irsend.sendRaw(buff, results.rawlen, 38);
oled.printString("Received IR");
// Print received hexadecimal IR code to the OLED screen
irrecv.enableIRIn();
irrecv.resume();
}
【问题讨论】:
-
什么是挥发性的?使用
volatile。 -
修正输入错误,易失(非易变)
-
您应该显示一个包含相关代码的 sn-p。然后可以准确地看出你的问题出在哪里。它可能与
volatile类型的属性有关,因为根据定义,它们通常与外部进程相关联,例如嵌入式微控制器,并且可以随时更改。