Hirdetés
- Xiaomi 14 - párátlanul jó lehetne
- Xiaomi 15T - reakció nélkül nincs egyensúly
- Xiaomi 15 - kicsi telefon nagy energiával
- Bemutatkozott a Poco X7 és X7 Pro
- Milyen okostelefont vegyek?
- Vivo X300 Pro – messzebbre lát, mint ameddig bírja
- Kompatibilis lett az Android Quick Share és az Apple AirDrop
- iPhone topik
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Google Pixel topik
-
Mobilarena
Arduino hardverrel és szoftverrel foglakozó téma. Minden mikrovezérlő ami arduinoval programozható, és minden arduino program, board, és hardverrel kapcsolatos kérdések helye.
Új hozzászólás Aktív témák
-
Saua
tag
Sziasztok,
Egy Samsung TV távirányítót szeretnék helyettesíteni arduinóval. Innen letöltöttem az IRLib könyvtárat, és az IRrecord példát szeretném kipróbálni.
A TV távirányító jelét veszi is, de nem világos, hogy az adó LED -et hova kell kötni. Kell módosítani a kódot?Ez a példaprogram:
/* Example program for from IRLib – an Arduino library for infrared encoding and decoding
* Version 1.5 June 2014
* Copyright 2014 by Chris Young http://cyborg5.com
* Based on original example sketch for IRremote library
* Version 0.11 September, 2009
* Copyright 2009 Ken Shirriff
* http://www.righto.com/
*/
/*
* IRrecord: record and play back IR signals
* An IR detector/demodulator must be connected to the input RECV_PIN.
* An IR LED must be connected to the appropriate pin.(See IRLibTimer.h) for your
* machine's timers and erupts.
* Record a value by pointing your remote at the device then send any character
* from the serial monitor to send the recorded value.
* Also demonstrates how to use toggle bits which must be controlled outside
* the library routines.
* The logic is:
* If an IR code is received, record it.
* If a serial character is received, send the IR code.
*/
#include <IRLib.h>
int RECV_PIN = 11;
IRrecv My_Receiver(RECV_PIN);
IRdecode My_Decoder;
IRsend My_Sender;
/*
* Because this version of the library separated the receiver from the decoder,
* technically you would not need to "store" the code outside the decoder object
* for this overly simple example. All of the details would remain in the object.
* However we are going to go ahead and store them just to show you how.
*/
// Storage for the recorded code
IRTYPES codeType; // The type of code
unsigned long codeValue; // The data bits if type is not raw
int codeBits; // The length of the code in bits
// These values are only stored if it's an unknown type and we are going to use
// raw codes to resend the information.
unsigned int rawCodes[RAWBUF]; // The durations if raw
int rawCount; //The number of interval samples
bool GotOne, GotNew;
void setup()
{
GotOne=false; GotNew=false;
codeType=UNKNOWN;
codeValue=0;
Serial.begin(9600);
delay(2000);while(!Serial);//delay for Leonardo
Serial.println(F("Send a code from your remote and we will record it."));
Serial.println(F("Type any character and press enter. We will send the recorded code."));
My_Receiver.enableIRIn(); // Start the receiver
}
// Stores the code for later playback
void storeCode(void) {
GotNew=true;
codeType = My_Decoder.decode_type;
if (codeType == UNKNOWN) {
Serial.println("Received unknown code, saving as raw");
// To store raw codes:
// Drop first value (gap)
// As of v1.3 of IRLib global values are already in microseconds rather than ticks
// They have also been adjusted for overreporting/underreporting of marks and spaces
rawCount = My_Decoder.rawlen-1;
for (int i = 1; i <=rawCount; i++) {
rawCodes[i - 1] = My_Decoder.rawbuf[i];
};
My_Decoder.DumpResults();
codeType=UNKNOWN;
}
else {
Serial.print(F("Received "));
Serial.print(Pnames(codeType));
if (My_Decoder.value == REPEAT) {
// Don't record a NEC repeat value as that's useless.
Serial.println(F("repeat; ignoring."));
}
else {
codeValue = My_Decoder.value;
codeBits = My_Decoder.bits;
}
Serial.print(F(" Value:0x"));
Serial.println(My_Decoder.value, HEX);
}
}
void sendCode(int repeat) {
if(codeType== UNKNOWN) {
// Assume 38 KHz
My_Sender.IRsendRaw::send(rawCodes,rawCount,38);
Serial.println(F("Sent raw"));
return;
}
if( !GotNew ) {//We've already sent this so handle toggle bits
if (codeType == RC5) {
codeValue ^= 0x0800;
}
else if (codeType == RC6) {
codeValue ^= 0x10000;
}
}
GotNew=false;
My_Sender.send(codeType,codeValue,codeBits);
Serial.print(F("Sent "));
Serial.print(Pnames(codeType));
Serial.print(F(" Value:0x"));
Serial.println(codeValue, HEX);
}
void loop() {
if (Serial.read() != -1) {
if(GotOne) {
sendCode(0);
My_Receiver.enableIRIn(); // Re-enable receiver
}
}
else if (My_Receiver.GetResults(&My_Decoder)) {
My_Decoder.decode();
GotOne=true;
storeCode();
delay(1000);
My_Receiver.resume();
}
}
Új hozzászólás Aktív témák
- Számos VGA kihalhat a memóriapánik miatt
- One otthoni szolgáltatások (TV, internet, telefon)
- Kuponkunyeráló
- Torrent meghívó kunyeráló
- Kormányok / autós szimulátorok topikja
- Okos Otthon / Smart Home
- Autóápolás, karbantartás, fényezés
- Kerékpárosok, bringások ide!
- PlayStation 5
- Autós topik
- További aktív témák...
- ASUS ROG Zephyrus G15 gamer laptop, Ryzen 9 6900HS, RTX 3070 Ti, 32gb DDR5 megvigyázott állapotban
- Niko Bis sarokkanapé FÉLÁRON sürgősen eladó!
- 2 TB, 1 TB, 500 GB 3,5 HDD bazár!
- 9gen i7 PC 1070ti vga-val
- Új 2k Gamer PC Ryzen 7 5800X/RX 9060 XT 16Gb OC/16- 32Gb DDR4/500Gb -2Tb SSD/750-850W 2-4 Év gari
- HIBÁTLAN iPhone 12 mini 64GB Green -1 ÉV GARANCIA - Kártyafüggetlen, MS3452,100% Akksi
- ÁRGARANCIA!Épített KomPhone Ryzen 5 7600X 32/64GB RAM RTX 5070 12GB GAMER PC termékbeszámítással
- Bomba ár! HP Pro X360 11 G1 - Intel N4200 I 4GB I 128GB SSD I 11,6" HD Touch I Cam I W11 I Gari
- ÚJ BONTATLAN Apple Macbook Air 15,3 M4 10C CPU/10C GPU/16GB/256GB - Égkék - HUN - mc7a4mg/a 3 év gar
- 3db apró szépséghibás DELL WD19S dokkolók (csak kábel résznél) (ELKELT)
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
ekkold

