Arduino红外遥控实验例子

2026/4/23 18:04:58

long off1 = 0x00FFE01F; long on2 = 0x00FF629D; long off2 = 0x00FFA857; long on3 = 0x00FFE21D; long off3 = 0x00FF906F; long on4 = 0x00FF22DD; long off4 = 0x00FF6897; long on5 = 0x00FF02FD; long off5 = 0x00FF9867; long on6 = 0x00FFC23D; long off6 = 0x00FFB047; IRrecv irrecv(RECV_PIN); decode_results results;

// Dumps out the decode_results structure. // Call this after IRrecv::decode() // void * to work around compiler issue //void dump(void *v) {

// decode_results *results = (decode_results *) void dump(decode_results *results) { int count = results->rawlen;

if (results->decode_type == UNKNOWN) {

Serial.println(\ } else {

if (results->decode_type == NEC) {

Serial.print(\ }

else if (results->decode_type == SONY) {

Serial.print(\ }

else if (results->decode_type == RC5) {

Serial.print(\ }

else if (results->decode_type == RC6) {

Serial.print(\ }

Serial.print(results->value, HEX); Serial.print(\

Serial.print(results->bits, DEC); Serial.println(\ }

Serial.print(\ Serial.print(count, DEC); Serial.print(\

for (int i = 0; i < count; i++) {

if ((i % 2) == 1) {

Serial.print(results->rawbuf[i]*USECPERTICK, DEC); } else {

Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC); }

Serial.print(\ }

Serial.println(\ }

void setup()

{

pinMode(RECV_PIN, INPUT); pinMode(LED1, OUTPUT); pinMode(LED2, OUTPUT); pinMode(LED3, OUTPUT); pinMode(LED4, OUTPUT); pinMode(LED5, OUTPUT); pinMode(LED6, OUTPUT); pinMode(13, OUTPUT); Serial.begin(9600);

irrecv.enableIRIn(); // Start the receiver }

int on = 0;

unsigned long last = millis();

void loop() {

if (irrecv.decode(&results)) {

// If it's been at least 1/4 second since the last


Arduino红外遥控实验例子.doc 将本文的Word文档下载到电脑
搜索更多关于: Arduino红外遥控实验例子 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219