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|none|358x358px]] |
==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;<br /> |
void setup () | void setup () | ||
{ | { | ||
− | + | Serial.begin (9600); | |
− | + | irrecv.enableIRIn (); / / Start the receiver | |
} | } | ||
− | void loop () { | + | void loop () <br />{ |
− | if (irrecv.decode (& results)) { | + | if (irrecv.decode (& results))<br /> { |
− | Serial.println (results.value, HEX); | + | Serial.println (results.value, HEX); |
− | irrecv.resume (); / / Receive the next value | + | irrecv.resume (); / / Receive the next value |
− | } | + | }<br />}<br /> |
− | } | + | |
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); |
− | } | + | }<br /> |
− | void loop () { | + | void loop ()<br />{ |
− | for (int i = 0; i <50; i + +) { | + | for (int i = 0; i <50; i + +) <br /> { |
− | irsend.sendSony (0xa90, 12); / / Sony TV power code | + | irsend.sendSony (0xa90, 12); / / Sony TV power code |
− | delay (40); | + | delay (40); |
− | } | + | } |
} | } | ||
</pre> | </pre> |
Version vom 9. Februar 2016, 14:43 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;<br /> void setup () { Serial.begin (9600); irrecv.enableIRIn (); / / Start the receiver } void loop () <br />{ if (irrecv.decode (& results))<br /> { Serial.println (results.value, HEX); irrecv.resume (); / / Receive the next value }<br />}<br /> Main emission part of the code: # Include IRsend irsend; void setup () { Serial.begin (9600); }<br /> void loop ()<br />{ for (int i = 0; i <50; i + +) <br /> { irsend.sendSony (0xa90, 12); / / Sony TV power code delay (40); } }