Показать сообщение отдельно
Старый 13.09.2016, 11:25   #6
ali_vlad
Старший Пользователь
 
Регистрация: 21.06.2014
Возраст: 46
Регион: 05
Машина: Hyundai Accent II
Сообщений: 556
ali_vlad is on a distinguished road
По умолчанию

Цитата:
Сообщение от Progressor Посмотреть сообщение
Конечно можно попробовать, но как выяснить протокол работы пульта?
PHP код:
#include <IRremote.h>

int RECV_PIN 10;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  
Serial.begin(9600);
  
irrecv.enableIRIn(); // Start the receiver
}

// 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 *)v
void dump(decode_results *results) {
  
int count results->rawlen;
  if (
results->decode_type == UNKNOWN) {
    
Serial.print("Unknown encoding: ");
  } 
  else if (
results->decode_type == NEC) {
    
Serial.print("Decoded NEC: ");
  } 
  else if (
results->decode_type == SONY) {
    
Serial.print("Decoded SONY: ");
  } 
  else if (
results->decode_type == RC5) {
    
Serial.print("Decoded RC5: ");
  } 
  else if (
results->decode_type == RC6) {
    
Serial.print("Decoded RC6: ");
  }
  else if (
results->decode_type == PANASONIC) {    
    
Serial.print("Decoded PANASONIC - Address: ");
    
Serial.print(results->panasonicAddress,HEX);
    
Serial.print(" Value: ");
  }
  else if (
results->decode_type == JVC) {
     
Serial.print("Decoded JVC: ");
  }
  
Serial.print(results->valueHEX);
  
Serial.print(" (");
  
Serial.print(results->bitsDEC);
  
Serial.println(" bits)");
  
Serial.print("Raw (");
  
Serial.print(countDEC);
  
Serial.print("): ");

  for (
int i 0counti++) {
    if ((
2) == 1) {
      
Serial.print(results->rawbuf[i]*USECPERTICKDEC);
    } 
    else {
      
Serial.print(-(int)results->rawbuf[i]*USECPERTICKDEC);
    }
    
Serial.print(" ");
  }
  
Serial.println("");
}


void loop() {
  if (
irrecv.decode(&results)) {
    
Serial.println(results.valueHEX);
    
dump(&results);
    
irrecv.resume(); // Receive the next value
  
}

Ик-приемник на 10й пин. Сам приемник можно выдрать из Вашего нерабочего блока.
ali_vlad вне форума   Ответить с цитированием