KY-005 Infrarot Transmitter Modul: Unterschied zwischen den Versionen
Aus Linkerkit.de
Zeile 1: | Zeile 1: | ||
==Bild== | ==Bild== | ||
− | [[Datei:ky-005.jpg | + | [[Datei:ky-005.jpg|358x358px|none]] |
==Technische Daten / Kurzbeschreibung== | ==Technische Daten / Kurzbeschreibung== | ||
Zeile 12: | Zeile 12: | ||
int RECV_PIN = 11; / / define input pin on Arduino | int RECV_PIN = 11; / / define input pin on Arduino | ||
IRrecv irrecv (RECV_PIN); | IRrecv irrecv (RECV_PIN); | ||
− | decode_results results; | + | decode_results results; |
void setup () | void setup () | ||
{ | { | ||
− | + | Serial.begin (9600); | |
− | + | irrecv.enableIRIn (); / / Start the receiver | |
} | } | ||
− | void loop () | + | |
− | + | void loop () | |
− | + | { | |
− | + | if (irrecv.decode (& results)) | |
− | + | { | |
+ | Serial.println (results.value, HEX); | ||
+ | irrecv.resume (); / / Receive the next value | ||
+ | } | ||
+ | } | ||
+ | |||
Main emission part of the code: | Main emission part of the code: | ||
# Include | # Include | ||
IRsend irsend; | IRsend irsend; | ||
+ | |||
void setup () | void setup () | ||
{ | { | ||
Serial.begin (9600); | Serial.begin (9600); | ||
− | } | + | } |
− | void loop () | + | |
− | + | void loop () | |
− | + | { | |
− | + | for (int i = 0; i <50; i + +) | |
− | + | { | |
− | } | + | irsend.sendSony (0xa90, 12); / / Sony TV power code |
+ | delay (40); | ||
+ | } | ||
+ | } | ||
</pre> | </pre> |
Version vom 9. Februar 2016, 14:45 Uhr
Inhaltsverzeichnis
Bild
Technische Daten / Kurzbeschreibung
Eine Leuchtdiode, die im infraroten Bereich ausstrahlt. Je nach Eingangsspannung, werden Vorwiderstände benötigt
Pin-Belegung
Codebeispiel Arduino
# Include int RECV_PIN = 11; / / define input pin on Arduino IRrecv irrecv (RECV_PIN); decode_results results; void setup () { Serial.begin (9600); irrecv.enableIRIn (); / / Start the receiver } void loop () { if (irrecv.decode (& results)) { Serial.println (results.value, HEX); irrecv.resume (); / / Receive the next value } } Main emission part of the code: # Include IRsend irsend; void setup () { Serial.begin (9600); } void loop () { for (int i = 0; i <50; i + +) { irsend.sendSony (0xa90, 12); / / Sony TV power code delay (40); } }