send ir signal with arduino mega
Posted: Sun Feb 16, 2020 3:17 pm
Hi,
i tried to send ir Raw code with arduino mega, but not out of the programm memory PROGMEM but out of a integer
i declared:
const unsigned int AC_irSignalON[] = {3208,9868,576,1532,532,492,524,524,544,516,528,1552,528,492,548,504,524,508,524,508,524,508,528,504,528,496,544,500,544,1548,528,512,500,532,528,508,524,508,520,1540,524,508,496,540,496,544,496,544,496,536,524,508,524,1532,548,1536,528,516,524,};
but it is to slow. i get 60 values, but the timing doesn`t fit.
my idea is to record ir Signal with Arduino Mege on SD card, read it from SD card and send it. but first off all i try to send the signal out off an integer.
is it possible?
here is the skech:
Dieter
i tried to send ir Raw code with arduino mega, but not out of the programm memory PROGMEM but out of a integer
i declared:
const unsigned int AC_irSignalON[] = {3208,9868,576,1532,532,492,524,524,544,516,528,1552,528,492,548,504,524,508,524,508,524,508,528,504,528,496,544,500,544,1548,528,512,500,532,528,508,524,508,520,1540,524,508,496,540,496,544,496,544,496,536,524,508,524,1532,548,1536,528,516,524,};
but it is to slow. i get 60 values, but the timing doesn`t fit.
my idea is to record ir Signal with Arduino Mege on SD card, read it from SD card and send it. but first off all i try to send the signal out off an integer.
is it possible?
here is the skech:
Code: Select all
/*
* IRremote: IRsendRawDemo - demonstrates sending IR codes with sendRaw
* An IR LED must be connected to Arduino PWM pin 3. (Defualt configuration for UNO class Arduinos)
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*
* IRsendRawFlash - added by AnalysIR (via www.AnalysIR.com), 11 April 2016
*
* This example shows how to send a RAW signal, from flash instead of SRAM, using the IRremote library.
*
* It is more efficient to use the sendNEC style function to send NEC signals.
* Use of sendRaw_Flash here, serves only as an example of using the function to save SRAM with RAW signals.
*
* Typical Uses: Allows users to store a significant number of signals in flash for sending, without using up SRAM.
* This is particularly important for sending RAW AC signal. Typically only one or 2 AC signals could be stored in SRAM using the traditional sendRAW function.
* With this function a large number of RAW AC signals can be stored & sent from Flash on a standard Arduino, with no material SRAM overhead.
* For even more Flash & signal storage, consider using a Mega1280/2560 with 128K/256K of available Flash vs the standard of 32k bytes.
*
* SRAM usage: On the Author's dev system the Arduino IDE 1.6.8 reported only 220 SRAM usage & 8,052 bytes of Flash storage used for this sketch.
* In contrast, only one of the signals below will fit on a standard UNO using the example sendRAW function of IRremote (using SRAM to store the signal)
*/
#include <IRremote.h>
IRsend irsend; //Pin 9 on Mega
//const unsigned int AC_irSignalON[] PROGMEM = {3208,9868,576,1532,532,492,524,524,544,516,528,1552,528,492,548,504,524,508,524,508,524,508,528,504,528,496,544,500,544,1548,528,512,500,532,528,508,524,508,520,1540,524,508,496,540,496,544,496,544,496,536,524,508,524,1532,548,1536,528,516,524,}; //AnalysIR Batch Export (IRremote) - RAW
const unsigned int AC_irSignalON[] = {3208,9868,576,1532,532,492,524,524,544,516,528,1552,528,492,548,504,524,508,524,508,524,508,528,504,528,496,544,500,544,1548,528,512,500,532,528,508,524,508,520,1540,524,508,496,540,496,544,496,544,496,536,524,508,524,1532,548,1536,528,516,524,}; //AnalysIR Batch Export (IRremote) - RAW
void setup() {
sendRAW_Flash(AC_irSignalON, sizeof(AC_irSignalON)/sizeof(int),38); //send AC signal #3 @ 38kHz
}
void loop() {
}
void sendRAW_Flash(const unsigned int * signalArray, unsigned int signalLength, unsigned char carrierFreq) {
irsend.enableIROut(carrierFreq); //initialise the carrier frequency for each signal to be sent
for (unsigned int i=0;i<signalLength;i++){
//tmp=pgm_read_word_near(&signalArray[i]);
// tmp=cleanPanasonic(tmp); //not needed
if (i & 1) irsend.space(pgm_read_word_near(&signalArray[i]));
else irsend.mark(pgm_read_word_near(&signalArray[i]));
}
irsend.space(1);//make sure IR is turned off at end of signal
}