KY-005 Infrarot Transmitter Modul: Unterschied zwischen den Versionen

Aus Linkerkit.de

Wechseln zu: Navigation, Suche
Zeile 1: Zeile 1:
 
==Bild==
 
==Bild==
[[Datei:ky-005.jpg|none|358x358px]]
+
[[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;<br />
+
decode_results results;
 
void setup ()
 
void setup ()
 
  {
 
  {
  Serial.begin (9600);
+
  Serial.begin (9600);
  irrecv.enableIRIn (); / / Start the receiver
+
  irrecv.enableIRIn (); / / Start the receiver
 
  }
 
  }
void loop () <br />{
+
 
if (irrecv.decode (& results))<br />  {
+
void loop ()  
    Serial.println (results.value, HEX);
+
{
    irrecv.resume (); / / Receive the next value
+
  if (irrecv.decode (& results))
  }<br />}<br />
+
  {
 +
    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);
  }<br />
+
  }
void loop ()<br />{
+
 
  for (int i = 0; i <50; i + +) <br />  {
+
void loop ()  
    irsend.sendSony (0xa90, 12); / / Sony TV power code
+
{
    delay (40);
+
  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

Bild

ky-005.jpg

Technische Daten / Kurzbeschreibung

Eine Leuchtdiode, die im infraroten Bereich ausstrahlt. Je nach Eingangsspannung, werden Vorwiderstände benötigt

Pin-Belegung

3 S V G.png

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);
   }
 }