memoria instabile su arduino uno

buonasera a tutti sono nuovo del forum e spero che sto scrivendo nel posto giusto.

ho un problema con la scrittura su arduino.

il mio progettino che sto cercando di creare:
ricevitore ir + trasmettitore ir :in pratica ho un proiettore che ha un telecomando che non si capisce la marca e vorrei usarlo con il telecomando della tv samsung.
Arduino riceve dei codici tramite ir e nello stesso tempo ne trasmette altri.

sono riuscire a scrivere e farlo funzionare : ma nonostante il programma mi dice che ho ancora spazio per scrivere ( 11kb di scrittura su 32kb liberi) dopo una certa mi si pianta. e non da + segni di vita . provo a cancellare una qualsiasi codifica e riparte,provo a riagiungere e si riblocca.come se non avesse più spazio.

Qualcuno mi può aiutare a capire il problema ? grazie in anticipo

questa è quello che ho creato fin ad ora :

#include <IRremote.h>
int RECV_PIN = 12;
IRrecv irrecv(RECV_PIN);
IRsend irsend; //usare pin 3
decode_results results;

unsigned int S_pwr[68]={8900,4400,600,550,550,1650,550,1700,550,550,550,550,550,550,550,550,600,1650,550,1650,550,1700,550,550,550,1650,550,600,550,1650,550,1650,550,600,550,1650,550,1650,600,1650,550,1650,550,1650,550,600,550,550,550,550,550,600,550,550,550,550,550,600,500,650,500,1650,550,1700,550,1650,500,};
unsigned int v_piu[68]={9050,4400,650,500,650,500,600,550,600,500,600,550,600,550,600,500,600,550,600,1650,600,1600,650,1600,600,1650,600,1600,650,1600,600,550,600,1600,650,500,600,1650,600,1650,600,500,600,550,600,550,600,1600,600,1650,600,1650,600,500,600,550,600,1650,600,1650,600,1600,600,550,600,550,600,};
unsigned int v_men[68]={9050,4400,650,500,650,500,600,500,650,500,600,550,600,500,650,500,600,550,600,1650,600,1600,600,1650,600,1650,600,1600,600,1650,600,550,600,1600,600,1650,600,550,600,1600,600,550,600,550,600,500,600,1650,600,1650,600,500,650,1600,600,550,600,1600,650,1600,600,1650,600,500,650,500,600,};
unsigned int ch_piu[68]={9050,4450,600,500,600,550,600,550,600,500,600,550,600,550,600,500,600,550,600,1650,600,1650,600,1600,600,1650,600,1650,600,1600,600,550,600,1650,600,1600,600,1650,600,1650,600,1600,650,1600,600,550,600,500,650,500,600,550,600,500,650,500,600,550,600,550,600,1600,600,1650,600,1650,600,};
unsigned int ch_men[68]={9050,4450,600,500,600,550,600,550,600,500,650,500,600,550,600,550,600,500,600,1650,600,1650,600,1600,600,1650,600,1650,600,1600,600,550,600,1650,600,1600,650,500,600,550,600,1650,600,500,600,550,600,1650,600,1600,600,550,600,1650,600,1600,600,550,600,1650,600,1600,650,500,600,550,600,};
unsigned int source_a[68]={8950,4400,600,500,600,1650,600,1600,600,500,600,550,600,500,600,500,600,1650,600,1600,600,1600,600,550,600,1600,600,500,600,1650,600,1600,600,500,600,1650,600,500,600,1600,600,500,650,500,600,500,600,500,600,550,600,500,600,1600,600,500,600,1650,600,1600,600,1650,600,1600,600,1600,600,};
unsigned int ok_b[68]={8950,4400,600,500,600,1600,600,1650,600,500,600,500,600,500,600,550,600,1600,600,1600,600,1650,600,500,600,1600,600,550,600,1600,600,1600,600,550,600,1600,600,500,600,500,600,550,600,500,600,500,600,550,600,500,600,500,600,1600,600,1650,600,1600,600,1650,600,1600,600,1600,600,1650,600,};
unsigned int fre_su[68]={8900,4400,600,550,600,1600,600,1600,600,550,600,500,600,500,600,500,650,1600,600,1600,600,1650,600,500,600,1600,600,500,600,1650,600,1600,600,500,600,550,550,1650,600,500,600,550,600,500,600,500,600,500,600,550,600,1600,600,500,600,1650,600,1600,600,1600,600,1650,600,1600,600,1650,600,};
unsigned int fre_giu[68]={8900,4400,600,550,600,1600,600,1600,600,550,600,500,600,500,600,500,600,1650,600,1600,600,1650,600,500,600,1600,600,550,600,1600,600,1600,600,550,600,500,600,1600,600,1650,600,500,600,500,600,500,600,550,600,500,600,1600,600,550,600,500,600,1600,600,1650,600,1600,600,1600,600,1650,600,};
unsigned int fre_de[68]={8950,4400,600,500,600,1600,600,1650,600,500,600,500,600,550,600,500,600,1600,600,1650,600,1600,600,500,600,1650,600,500,600,1600,600,1650,600,500,600,1600,600,1650,600,1600,600,500,600,550,600,500,550,550,600,500,600,550,600,500,600,500,600,1650,550,1650,600,1600,600,1650,550,1650,600,};
unsigned int fre_sx[68]={8950,4400,600,500,600,1600,600,1650,600,500,600,500,600,500,600,550,600,1600,600,1600,650,1600,600,500,600,1650,600,500,600,1600,600,1650,600,500,600,500,600,500,600,1650,600,500,600,500,600,500,650,500,600,500,600,1600,600,1650,600,500,600,1600,600,1650,600,1600,600,1650,600,1600,600,};
unsigned int menu_g[68]={8950,4400,600,550,600,1600,600,1600,600,550,600,500,600,500,600,500,600,1650,600,1600,600,1600,650,500,600,1600,600,500,600,1650,600,1600,600,500,600,1650,600,500,600,1600,600,550,600,1600,600,500,600,550,600,500,600,500,600,1650,600,500,600,1600,600,500,600,1650,600,1600,600,1650,600,};
unsigned int ch_1[68]={9050,4400,650,500,600,500,650,500,600,550,600,550,600,500,600,550,600,550,600,1600,600,1650,600,1650,600,1650,600,1600,600,1650,600,550,600,1600,600,550,600,1650,600,500,600,550,600,1650,600,500,600,1650,600,550,600,1600,600,550,600,1650,600,1600,600,550,600,1650,600,550,600,1600,600,};
unsigned int ch_i[68]={9050,4450,600,500,600,550,600,550,600,500,6650,600,1600,600,5};
unsigned int ch_l[68]={9050,4450,600,500,600,550,600,550,600,5};
unsigned int ch_m[68]={9050,4450,600,500,600,550,600,550,600};



void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop() 
{
if (irrecv.decode(&results)) 
{
  
  
  
 if(results.value==0xF4BA2988 )
 {
  Serial.println("ON");
  irsend.sendRaw(S_pwr,68,38);
  delay(200);
  irrecv.enableIRIn();
 } // if
 else Serial.println(results.value, HEX);
 
 
   
 if(results.value==0x68733A46)
 {
  Serial.println("vpiu");
  irsend.sendRaw(v_piu,68,38);
  delay(50);
  irrecv.enableIRIn();
 } // if
 else Serial.println(results.value, HEX);

 
 
 
 if(results.value==0x83B19366)
 {
  Serial.println("vmen");
  irsend.sendRaw(v_men,68,38);
  delay(50);
  irrecv.enableIRIn();
 } // if
 else Serial.println(results.value, HEX);
 
    if(results.value==0x8AF13528)
 {
  Serial.println("ok");
  irsend.sendRaw(ok_b,68,38);
 delay(50);
  irrecv.enableIRIn();
 } // if
 else Serial.println(results.value, HEX);
 
 

    if(results.value==0x5F12E8C4)
 {
  Serial.println("chpiu");
  irsend.sendRaw(ch_piu,68,38);
 delay(50);
  irrecv.enableIRIn();
 } // if
 else Serial.println(results.value, HEX);
 
 
 
 
  if(results.value==0x189D7928)
 {
  Serial.println("chmen");
  irsend.sendRaw(ch_men,68,38);
 delay(50);
  irrecv.enableIRIn();
 } // if
 else Serial.println(results.value, HEX);
 
  if(results.value==0xCE3693E6)
 {
  Serial.println("source");
  irsend.sendRaw(source_a,68,38);
 delay(50);
  irrecv.enableIRIn();
 } // if
 else Serial.println(results.value, HEX);
 

   if(results.value==0xC4FFB646)
 {
  Serial.println("frecciagiu");
  irsend.sendRaw(fre_giu,68,38);
  delay(50);
  irrecv.enableIRIn();
 } // if
 else Serial.println(results.value, HEX);
 
  if(results.value==0x5012B852)
 {
  Serial.println("frecciasu");
  irsend.sendRaw(fre_su,68,38);
  delay(50);
  irrecv.enableIRIn();
 } // if
 else Serial.println(results.value, HEX);
 
    if(results.value==0x66BF40E8)
 {
  Serial.println("menu");
  irsend.sendRaw(menu_g,68,38);
 delay(50);
  irrecv.enableIRIn();
 } // if
 else Serial.println(results.value, HEX);
 
 
 


 irrecv.resume();
} //if 
} // loop

You have 16 arrays of 68 elements of 2 bytes each - I get 2176 bytes, but the Arduino Uno only has 2048 bytes of RAM (and the leo only slightly more, such that you might still get into memory trouble).

Those static arrays should go into PROGMEM - but interfacing that with the the IR libraries (which expect an array in RAM) will be tricky (either requiring modifying the library to make one that reads the data from progmem, or pulling the data from progmem into a single array in RAM right before you send it).

>cosimoedy: Prima di tutto, nella sezione in lingua Inglese si può scrivere SOLO in Inglese … quindi, per favore, la prossima volta presta più attenzione in quale sezione metti i tuoi post …

… poi, essendo il tuo primo post, nel rispetto del regolamento della sezione Italiana del forum (… punto 13, primo capoverso), ti chiedo cortesemente di presentarti IN QUESTO THREAD (spiegando bene quali conoscenze hai di elettronica e di programmazione … possibilmente evitando di scrivere solo una riga di saluto) e di leggere con MOLTA attenzione il su citato REGOLAMENTO

… infine, in conformità al suddetto regolamento, punto 7, devi editare il tuo post (quindi NON scrivendo un nuovo post, ma utilizzando il bottone More → Modify che si trova in basso a destra del tuo post) e racchiudere il codice all’interno dei tag CODE (… sono quelli che in edit inserisce il bottone con icona fatta così: </>, tutto a sinistra).

In pratica, tutto il tuo codice dovrà trovarsi racchiuso tra due tag: [code] _il _tuo_ codice_ [/code] così da non venire interpretato e non dare adito alla formazione di caratteri indesiderati o cattiva formattazione del testo. Grazie.

Guglielmo

scusatemi ma con l'inglese non sono pratico, non riesco a trovare dove il forum è in italiano. guardando il link regolamento indica come fare . ma nella mia schermata non esce nessuna modifica di lingua. ho scritto un altro post di presentazione e spero che questa volta ho scritto nel posto giusto.

... il post è messo nel posto giusto :)

Ora non ti resta che modificare il tuo primo post (per la parte codice) come ti ho spiegato alla fine del mio post #2. Grazie.

Guglielmo

salve Guglielmo spero che ora ho sistemato il tutto , scusatemi ancora

Come ha detto DrAzzy devi usare PROGMEM per i vettori, che però diventano in sola lettura.
Così:

#include <IRremote.h>

int RECV_PIN = 12;
IRrecv irrecv(RECV_PIN);
IRsend irsend; //usare pin 3
decode_results results;

PROGMEM const unsigned int S_pwr[68] = {8900, 4400, 600, 550, 550, 1650, 550, 1700, 550, 550, 550, 550, 550, 550, 550, 550, 600, 1650, 550, 1650, 550, 1700, 550, 550, 550, 1650, 550, 600, 550, 1650, 550, 1650, 550, 600, 550, 1650, 550, 1650, 600, 1650, 550, 1650, 550, 1650, 550, 600, 550, 550, 550, 550, 550, 600, 550, 550, 550, 550, 550, 600, 500, 650, 500, 1650, 550, 1700, 550, 1650, 500,};
PROGMEM const unsigned int v_piu[68] = {9050, 4400, 650, 500, 650, 500, 600, 550, 600, 500, 600, 550, 600, 550, 600, 500, 600, 550, 600, 1650, 600, 1600, 650, 1600, 600, 1650, 600, 1600, 650, 1600, 600, 550, 600, 1600, 650, 500, 600, 1650, 600, 1650, 600, 500, 600, 550, 600, 550, 600, 1600, 600, 1650, 600, 1650, 600, 500, 600, 550, 600, 1650, 600, 1650, 600, 1600, 600, 550, 600, 550, 600,};
PROGMEM const unsigned int v_men[68] = {9050, 4400, 650, 500, 650, 500, 600, 500, 650, 500, 600, 550, 600, 500, 650, 500, 600, 550, 600, 1650, 600, 1600, 600, 1650, 600, 1650, 600, 1600, 600, 1650, 600, 550, 600, 1600, 600, 1650, 600, 550, 600, 1600, 600, 550, 600, 550, 600, 500, 600, 1650, 600, 1650, 600, 500, 650, 1600, 600, 550, 600, 1600, 650, 1600, 600, 1650, 600, 500, 650, 500, 600,};
PROGMEM const unsigned int ch_piu[68] = {9050, 4450, 600, 500, 600, 550, 600, 550, 600, 500, 600, 550, 600, 550, 600, 500, 600, 550, 600, 1650, 600, 1650, 600, 1600, 600, 1650, 600, 1650, 600, 1600, 600, 550, 600, 1650, 600, 1600, 600, 1650, 600, 1650, 600, 1600, 650, 1600, 600, 550, 600, 500, 650, 500, 600, 550, 600, 500, 650, 500, 600, 550, 600, 550, 600, 1600, 600, 1650, 600, 1650, 600,};
PROGMEM const unsigned int ch_men[68] = {9050, 4450, 600, 500, 600, 550, 600, 550, 600, 500, 650, 500, 600, 550, 600, 550, 600, 500, 600, 1650, 600, 1650, 600, 1600, 600, 1650, 600, 1650, 600, 1600, 600, 550, 600, 1650, 600, 1600, 650, 500, 600, 550, 600, 1650, 600, 500, 600, 550, 600, 1650, 600, 1600, 600, 550, 600, 1650, 600, 1600, 600, 550, 600, 1650, 600, 1600, 650, 500, 600, 550, 600,};
PROGMEM const unsigned int source_a[68] = {8950, 4400, 600, 500, 600, 1650, 600, 1600, 600, 500, 600, 550, 600, 500, 600, 500, 600, 1650, 600, 1600, 600, 1600, 600, 550, 600, 1600, 600, 500, 600, 1650, 600, 1600, 600, 500, 600, 1650, 600, 500, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 500, 600, 550, 600, 500, 600, 1600, 600, 500, 600, 1650, 600, 1600, 600, 1650, 600, 1600, 600, 1600, 600,};
PROGMEM const unsigned int ok_b[68] = {8950, 4400, 600, 500, 600, 1600, 600, 1650, 600, 500, 600, 500, 600, 500, 600, 550, 600, 1600, 600, 1600, 600, 1650, 600, 500, 600, 1600, 600, 550, 600, 1600, 600, 1600, 600, 550, 600, 1600, 600, 500, 600, 500, 600, 550, 600, 500, 600, 500, 600, 550, 600, 500, 600, 500, 600, 1600, 600, 1650, 600, 1600, 600, 1650, 600, 1600, 600, 1600, 600, 1650, 600,};
PROGMEM const unsigned int fre_su[68] = {8900, 4400, 600, 550, 600, 1600, 600, 1600, 600, 550, 600, 500, 600, 500, 600, 500, 650, 1600, 600, 1600, 600, 1650, 600, 500, 600, 1600, 600, 500, 600, 1650, 600, 1600, 600, 500, 600, 550, 550, 1650, 600, 500, 600, 550, 600, 500, 600, 500, 600, 500, 600, 550, 600, 1600, 600, 500, 600, 1650, 600, 1600, 600, 1600, 600, 1650, 600, 1600, 600, 1650, 600,};
PROGMEM const unsigned int fre_giu[68] = {8900, 4400, 600, 550, 600, 1600, 600, 1600, 600, 550, 600, 500, 600, 500, 600, 500, 600, 1650, 600, 1600, 600, 1650, 600, 500, 600, 1600, 600, 550, 600, 1600, 600, 1600, 600, 550, 600, 500, 600, 1600, 600, 1650, 600, 500, 600, 500, 600, 500, 600, 550, 600, 500, 600, 1600, 600, 550, 600, 500, 600, 1600, 600, 1650, 600, 1600, 600, 1600, 600, 1650, 600,};
PROGMEM const unsigned int fre_de[68] = {8950, 4400, 600, 500, 600, 1600, 600, 1650, 600, 500, 600, 500, 600, 550, 600, 500, 600, 1600, 600, 1650, 600, 1600, 600, 500, 600, 1650, 600, 500, 600, 1600, 600, 1650, 600, 500, 600, 1600, 600, 1650, 600, 1600, 600, 500, 600, 550, 600, 500, 550, 550, 600, 500, 600, 550, 600, 500, 600, 500, 600, 1650, 550, 1650, 600, 1600, 600, 1650, 550, 1650, 600,};
PROGMEM const unsigned int fre_sx[68] = {8950, 4400, 600, 500, 600, 1600, 600, 1650, 600, 500, 600, 500, 600, 500, 600, 550, 600, 1600, 600, 1600, 650, 1600, 600, 500, 600, 1650, 600, 500, 600, 1600, 600, 1650, 600, 500, 600, 500, 600, 500, 600, 1650, 600, 500, 600, 500, 600, 500, 650, 500, 600, 500, 600, 1600, 600, 1650, 600, 500, 600, 1600, 600, 1650, 600, 1600, 600, 1650, 600, 1600, 600,};
PROGMEM const unsigned int menu_g[68] = {8950, 4400, 600, 550, 600, 1600, 600, 1600, 600, 550, 600, 500, 600, 500, 600, 500, 600, 1650, 600, 1600, 600, 1600, 650, 500, 600, 1600, 600, 500, 600, 1650, 600, 1600, 600, 500, 600, 1650, 600, 500, 600, 1600, 600, 550, 600, 1600, 600, 500, 600, 550, 600, 500, 600, 500, 600, 1650, 600, 500, 600, 1600, 600, 500, 600, 1650, 600, 1600, 600, 1650, 600,};
PROGMEM const unsigned int ch_1[68] = {9050, 4400, 650, 500, 600, 500, 650, 500, 600, 550, 600, 550, 600, 500, 600, 550, 600, 550, 600, 1600, 600, 1650, 600, 1650, 600, 1650, 600, 1600, 600, 1650, 600, 550, 600, 1600, 600, 550, 600, 1650, 600, 500, 600, 550, 600, 1650, 600, 500, 600, 1650, 600, 550, 600, 1600, 600, 550, 600, 1650, 600, 1600, 600, 550, 600, 1650, 600, 550, 600, 1600, 600,};
PROGMEM const unsigned int ch_i[68] = {9050, 4450, 600, 500, 600, 550, 600, 550, 600, 500, 6650, 600, 1600, 600, 5};
PROGMEM const unsigned int ch_l[68] = {9050, 4450, 600, 500, 600, 550, 600, 550, 600, 5};
PROGMEM const unsigned int ch_m[68] = {9050, 4450, 600, 500, 600, 550, 600, 550, 600};

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn();
}
void loop()
{
  if (irrecv.decode(&results))
  {
    if (results.value == 0xF4BA2988 )
    {
      Serial.println("ON");
      irsend.sendRaw(S_pwr, 68, 38);
      delay(200);
      irrecv.enableIRIn();
    } // if
    else
      Serial.println(results.value, HEX);

    if (results.value == 0x68733A46)
    {
      Serial.println("vpiu");
      irsend.sendRaw(v_piu, 68, 38);
      delay(50);
      irrecv.enableIRIn();
    } // if
    else
      Serial.println(results.value, HEX);

    if (results.value == 0x83B19366)
    {
      Serial.println("vmen");
      irsend.sendRaw(v_men, 68, 38);
      delay(50);
      irrecv.enableIRIn();
    } // if
    else
      Serial.println(results.value, HEX);

    if (results.value == 0x8AF13528)
    {
      Serial.println("ok");
      irsend.sendRaw(ok_b, 68, 38);
      delay(50);
      irrecv.enableIRIn();
    } // if
    else
      Serial.println(results.value, HEX);

    if (results.value == 0x5F12E8C4)
    {
      Serial.println("chpiu");
      irsend.sendRaw(ch_piu, 68, 38);
      delay(50);
      irrecv.enableIRIn();
    } // if
    else
      Serial.println(results.value, HEX);

    if (results.value == 0x189D7928)
    {
      Serial.println("chmen");
      irsend.sendRaw(ch_men, 68, 38);
      delay(50);
      irrecv.enableIRIn();
    } // if
    else
      Serial.println(results.value, HEX);

    if (results.value == 0xCE3693E6)
    {
      Serial.println("source");
      irsend.sendRaw(source_a, 68, 38);
      delay(50);
      irrecv.enableIRIn();
    } // if
    else
      Serial.println(results.value, HEX);

    if (results.value == 0xC4FFB646)
    {
      Serial.println("frecciagiu");
      irsend.sendRaw(fre_giu, 68, 38);
      delay(50);
      irrecv.enableIRIn();
    } // if
    else
      Serial.println(results.value, HEX);

    if (results.value == 0x5012B852)
    {
      Serial.println("frecciasu");
      irsend.sendRaw(fre_su, 68, 38);
      delay(50);
      irrecv.enableIRIn();
    } // if
    else
      Serial.println(results.value, HEX);

    if (results.value == 0x66BF40E8)
    {
      Serial.println("menu");
      irsend.sendRaw(menu_g, 68, 38);
      delay(50);
      irrecv.enableIRIn();
    } // if
    else
      Serial.println(results.value, HEX);

    irrecv.resume();
  } //if
} // loop

Compila, ma non ho idea se funziona senza la modifica della libreria.

Segui le indicazioni di Guglielmo nel post qui sotto.

Vi ricordo QUESTO mio thread relativo a IRremote e l'uso di PROGMEM ... ;)

Guglielmo

sta sera provo e vi farò sapere , intanto grazie per i consigli.

ho provato ma mi da questo errore :

sketch_oct08a.ino: In function 'void loop()':
sketch_oct08a:37: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:37: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:47: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:47: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:57: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:57: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:67: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:67: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:77: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:77: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:87: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:87: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:97: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:97: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:107: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:107: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:117: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:117: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:127: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:127: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'

ho provato ma senza risultati con codici di errori:

sketch_oct08a.ino: In function 'void loop()':
sketch_oct08a:37: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:37: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:47: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:47: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:57: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:57: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:67: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:67: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:77: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:77: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:87: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:87: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:97: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:97: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:107: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:107: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:117: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:117: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
sketch_oct08a:127: error: invalid conversion from 'const unsigned int*' to 'unsigned int*'
sketch_oct08a:127: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
unsigned int S_pwr[68]={8900,4400,600,550,550,1650,550,1700,550,550,550,550,550,550,550,550,600,1650,550,1650,550,1700,550,550,550,1650,550,600,550,1650,550,1650,550,600,550,1650,550,1650,600,1650,550,1650,550,1650,550,600,550,550,550,550,550,600,550,550,550,550,550,600,500,650,500,1650,550,1700,550,1650,500,};
unsigned int v_piu[68]={9050,4400...........

non è che hai provato…

int S_pwr[68]=  {8900,4400,600,550,550,1650,550,1700,550,550,550,550,550,550,550,550,600,1650,550,1650,550,1700,550,550,550,1650,550,600,550,1650,550,1650,550,600,550,1650,550,1650,600,1650,550,1650,550,1650,550,600,550,550,550,550,550,600,550,550,550,550,550,600,500,650,500,1650,550,1700,550,1650,500,};
int v_piu[68]={9050,4400......

non riesco a capire cosa intende , ripeto sono alle prime armi

prova a levare la parola unsigned davanti agli array

ho provato anche a togliere la parola ma niente mi evidenzia niente da fare ora sto cercando con pochi tasti
per poi aumentarli ma non riesco in nessun modo.

#include <IRremote.h>

int RECV_PIN = 12;
IRrecv irrecv(RECV_PIN);
IRsend irsend; //usare pin 3
decode_results results;

PROGMEM const  int S_pwr[68] = {8900, 4400, 600, 550, 550, 1650, 550, 1700, 550, 550, 550, 550, 550, 550, 550, 550, 600, 1650, 550, 1650, 550, 1700, 550, 550, 550, 1650, 550, 600, 550, 1650, 550, 1650, 550, 600, 550, 1650, 550, 1650, 600, 1650, 550, 1650, 550, 1650, 550, 600, 550, 550, 550, 550, 550, 600, 550, 550, 550, 550, 550, 600, 500, 650, 500, 1650, 550, 1700, 550, 1650, 500,};
PROGMEM const  int v_piu[68] = {9050, 4400, 650, 500, 650, 500, 600, 550, 600, 500, 600, 550, 600, 550, 600, 500, 600, 550, 600, 1650, 600, 1600, 650, 1600, 600, 1650, 600, 1600, 650, 1600, 600, 550, 600, 1600, 650, 500, 600, 1650, 600, 1650, 600, 500, 600, 550, 600, 550, 600, 1600, 600, 1650, 600, 1650, 600, 500, 600, 550, 600, 1650, 600, 1650, 600, 1600, 600, 550, 600, 550, 600,};
PROGMEM const  int v_men[68] = {9050, 4400, 650, 500, 650, 500, 600, 500, 650, 500, 600, 550, 600, 500, 650, 500, 600, 550, 600, 1650, 600, 1600, 600, 1650, 600, 1650, 600, 1600, 600, 1650, 600, 550, 600, 1600, 600, 1650, 600, 550, 600, 1600, 600, 550, 600, 550, 600, 500, 600, 1650, 600, 1650, 600, 500, 650, 1600, 600, 550, 600, 1600, 650, 1600, 600, 1650, 600, 500, 650, 500, 600,};

void loop()
{
  if (irrecv.decode(&results))
  {
    if (results.value == 0xF4BA2988 )
    {
      Serial.println("ON");
      irsend.sendRaw(S_pwr, 68, 38);
      delay(200);
      irrecv.enableIRIn();
    } // if
    else
      Serial.println(results.value, HEX);

    if (results.value == 0x68733A46)
    {
      Serial.println("vpiu");
      irsend.sendRaw(v_piu, 68, 38);
      delay(50);
      irrecv.enableIRIn();
    } // if
    else
      Serial.println(results.value, HEX);

    if (results.value == 0x83B19366)
    {
      Serial.println("vmen");
      irsend.sendRaw(v_men, 68, 38);
      delay(50);
      irrecv.enableIRIn();
    } // if
    else
      Serial.println(results.value, HEX);

 
    irrecv.resume();
  } //if
} // loop

... ma almeno hai letto il link di cui al mio post #7 ? :o :o :o

Per usare PROGMEM bisogna MODIFICARE la libreria e creare un nuovo metodo per l'accesso ai dati in flash !

Guglielmo

si l’ho letto e che non ci ho capito quasi niente:
come si modifica la libreria?

si l’ho letto non ci ho capito quasi niente , come si aggiunge la libreria?

ora sto provando a crearlo cosi’ ma non capisco dov’è che sbaglio

se qualcuno mi può aitare ne sarei molto grato

#include <IRremote.h>
#include <avr/pgmspace.h>

int RECV_PIN = 12;
IRrecv irrecv(RECV_PIN);
IRsend irsend; //usare pin 3
decode_results results;



static const unsigned char theFrequency = 36U;

static const unsigned int EXITkey_1[] PROGMEM = {
   2652,1816,704,268,376,260,376,260,680,600,396,232,380,264,400,268,368,240,376,264,400,
   264,344,268,396,240,376,260,376,264,372,268,376,260,680,596,676,264,400,564,688,264,376,
   596,676,600,676,596,680,268,372,596,372
};
unsigned long tEXIT_1 = 73362;

;

// Send EXITkey




//


static const unsigned int EXITkey_2[107] PROGMEM = {
   2652,1816,728,272,340,268,396,240,680,596,
   372,264,376,264,372,268,372,264,372,268,372,260,376,264,376,264,372,264,396,232,384,264,
   372,264,680,600,676,264,376,596,700,240,376,600,676,596,680,596,676,268,372,596,372,
   25388,2652,1804,720,264,372,268,368,264,680,600,372,264,372,268,396,232,688,596,372,264,
   400,240,372,268,372,264,372,264,396,240,376,264,680,600,672,268,396,572,680,264,372,588,
   692,592,680,264,400,240,372,264,376,596,376
};

void setup()
{
 Serial.begin(9600);
 irrecv.enableIRIn();}
 void loop() {
    irsend.sendRaw_P(EXITkey_1, (unsigned char) (sizeof(EXITkey_1) / sizeof(unsigned int)), theFrequency);
    delay(1000);
}