Cześć,
Robię projekt odbierania sygnałów przez piloty posiadające nadajnik IR. Prawidłowo odbieram kody, lecz chciałem dodać powiadomienia diodami. Czerwona dioda sygnalizuje otrzymany już kod, natomiast zielona dioda sygnalizuje nowy kod.
Sygnał jest podawany na wyjścia, lecz diody się nie świecą, sprawdzałem przykładając + z buzzera czy w ogóle podaje sygnał.
Dodam, że dopiero zaczynam przygodę z Arduino. Dołączam kod oraz schemat.
#include &tIRremote.hpp&t
int RECV_PIN = 10;
IRrecv irrecv(RECV_PIN);
decode_results results;
int redPin = 6;
int greenPin = 3;
void setup()
{
Serial.begin(9600);
IrReceiver.begin(RECV_PIN, ENABLE_LED_FEEDBACK); // Start the receiver
irrecv.blink13(true);
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
irrecv.enableIRIn();
}
void loop() {
if (IrReceiver.decode()) {
Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX); // Print "old" raw data
/* USE NEW 3.x FUNCTIONS */
IrReceiver.printIRResultShort(&Serial); // Print complete received data in one line
IrReceiver.printIRSendUsage(&Serial); // Print the statement required to send this data
IrReceiver.resume(); // Enable receiving of the next value
switch(&results){
case 0xFB020707: //Keypad button "5"
digitalWrite(redPin, HIGH);
delay(2000);
digitalWrite(redPin, LOW);
}
switch(&results){
case 0xFB040707: //Keypad button "2"
digitalWrite(greenPin, HIGH);
delay(2000);
digitalWrite(greenPin, LOW);
}
irrecv.resume();
}
}
Dziękuję za pomoc
Robię projekt odbierania sygnałów przez piloty posiadające nadajnik IR. Prawidłowo odbieram kody, lecz chciałem dodać powiadomienia diodami. Czerwona dioda sygnalizuje otrzymany już kod, natomiast zielona dioda sygnalizuje nowy kod.
Sygnał jest podawany na wyjścia, lecz diody się nie świecą, sprawdzałem przykładając + z buzzera czy w ogóle podaje sygnał.
Dodam, że dopiero zaczynam przygodę z Arduino. Dołączam kod oraz schemat.
#include &tIRremote.hpp&t
int RECV_PIN = 10;
IRrecv irrecv(RECV_PIN);
decode_results results;
int redPin = 6;
int greenPin = 3;
void setup()
{
Serial.begin(9600);
IrReceiver.begin(RECV_PIN, ENABLE_LED_FEEDBACK); // Start the receiver
irrecv.blink13(true);
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
irrecv.enableIRIn();
}
void loop() {
if (IrReceiver.decode()) {
Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX); // Print "old" raw data
/* USE NEW 3.x FUNCTIONS */
IrReceiver.printIRResultShort(&Serial); // Print complete received data in one line
IrReceiver.printIRSendUsage(&Serial); // Print the statement required to send this data
IrReceiver.resume(); // Enable receiving of the next value
switch(&results){
case 0xFB020707: //Keypad button "5"
digitalWrite(redPin, HIGH);
delay(2000);
digitalWrite(redPin, LOW);
}
switch(&results){
case 0xFB040707: //Keypad button "2"
digitalWrite(greenPin, HIGH);
delay(2000);
digitalWrite(greenPin, LOW);
}
irrecv.resume();
}
}
Dziękuję za pomoc
