Go Down

Topic: Problemone con PROGMEM :( (Read 10403 times) previous topic - next topic

PaoloP

Se ha la VPN vuol dire che al momento funziona solo in rete locale.
Quindi dovrebbe essere abbastanza sicuro.  ;)


roxdragon

Grazie!
Beh per quanto riguarda le connessioni indesidirate, essendo che vi si può accedere solo da VPN, penso che sia abbastanza protetta, magari dovrei mettere una password.
Le porte sono chiuse da remoto!
Tu hai qualche consiglio?


Se ha la VPN vuol dire che al momento funziona solo in rete locale.
Quindi dovrebbe essere abbastanza sicuro.  ;)



esatto cosi evito di aprire le porte all'esterno!

WeezyDesire

#47
Oct 12, 2014, 05:33 pm Last Edit: Oct 12, 2014, 06:01 pm by WeezyDesire Reason: 1

Code: [Select]
         if ( readString.indexOf("C=30") > 0 )
           ReadFlash(C30,VDIM(C30)
[code]void ReadFlash(const uint16_t *x , byte len){
 unsigned int buffer[256];
 for (byte i=0; i < len; i++) {
   buffer[i] = pgm_read_word( &x+i );
 }
 My_Sender.IRsendRaw::send(buffer, len, khz);
}
 non va... però compila... perche?

Code: [Select]

   buffer[i] = pgm_read_word( x+i );
   Serial.println(buffer[i]);
 }
 My_Sender.IRsendRaw::send(buffer, len, khz);
}


togliendo &
modificando cosi, sulla seriale riesco a vedere tutto l'array C30 però non invia il codice, cioè non mi si accende il condizionatore mentre con questo codice si:

Code: [Select]
void loop(){
byte lenght = sizeof(C30)/sizeof(int);
           for (byte i=0; i < lenght; i++)
           {
             buffer[i] = pgm_read_word( &C30[i] );        // forse senza &
            }
            My_Sender.IRsendRaw::send(buffer, lenght, khz);
[/code]


EDIT Adesso funziona tutto correttamente... se ho problemi riscrivo... spero di no
Grazie a tutti ragazzi siete stati gentilissimi :D




Ho provato a riadattare il vostro codice per un mio progettino,uso la IRremote.h, però non riesco ad inviare i segnali IR.
Sapreste dirmi dove sbaglio? Grazie

Code: [Select]

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


#define VDIM(v) (sizeof(v)/sizeof((v[0]))

String readString;
IRsend irsend;



PROGMEM  prog_uint16_t on[]  = {8900,4400,650,1600,650,1650,600,500,650,550,650,500,600,550,600,500,650,1650,650,500,650,1550,700,1600,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,1600,650,550,600,550,600,500,650,500,650,550,600,550,600,1650,600,500,650,550,650,500,650,500,600,550,600,1650,650,500,650,500,650,500,600,550,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,600};

PROGMEM  prog_uint16_t condsuper[]={9100,4250,800,1450,700,1550,750,400,750,450,750,350,800,350,750,400,650,1600,700,500,750,1450,750,1550,750,400,650,500,800,350,750,350,750,450,800,1450,650,500,800,350,750,400,700,450,800,350,750,400,750,400,800,350,750,1500,650,500,800,350,750,400,650,500,800,350,750,400,650,500,800,350,800,350,750,450,750,400,750,350,700,450,650,550,750,350,750,400,650,500,750,400,750,1550,750,350,750,400,700,1550,700};
PROGMEM  prog_uint16_t condalt[]={9000,4400,650,1650,600,1650,600,500,650,550,650,500,650,500,600,550,600,1650,650,500,650,1600,650,1600,650,500,650,500,650,500,650,500,650,550,600,500,650,500,650,500,650,550,600,500,650,500,650,500,650,550,600,550,600,1650,600,500,600,600,650,500,600,550,600,550,600,550,650,500,650,500,600,550,600,550,600,550,650,500,650,500,600,550,650,500,650,500,650,500,650,500,650,500,650,500,600,550,600,550,600};
PROGMEM  prog_uint16_t condmed[]={9000,4400,650,1650,600,1600,650,500,650,550,650,500,650,500,600,550,600,1650,650,500,650,1600,650,1550,700,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,550,600,500,650,500,650,500,650,550,600,550,600,1600,650,500,650,550,650,1550,700,500,600,1650,600,550,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650};
PROGMEM  prog_uint16_t condbas[]={8950,4450,650,1600,650,1600,650,450,700,500,650,500,650,500,650,500,650,1600,650,500,650,1600,650,1600,650,550,600,550,600,500,650,500,650,500,700,500,600,550,600,500,650,550,650,450,700,500,600,550,600,550,650,500,650,1600,650,500,600,550,650,500,650,500,650,500,650,1600,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,550,600,500,650,500,650,500,650,550,600,500,650,500,650,500,650,500,650};


PROGMEM  prog_uint16_t riscalt[]={9000,4450,650,1550,700,1600,650,500,600,550,650,500,650,500,650,500,650,1600,650,500,650,1600,650,1600,650,550,600,500,650,500,650,500,650,550,600,550,600,500,650,500,650,550,650,500,600,550,600,550,600,550,650,500,650,500,600,550,600,550,650,500,650,1600,650,1600,650,1600,650,500,650,500,650,500,650,550,600,500,650,500,650,500,650,550,600,500,650,500,650,500,650,550,600,550,600,500,650,500,650,500,650};


//static const uint16_t *IR[] PROGMEM = {on, condsuper, condalt, condmed, condbas,riscalt};


void ReadFlash(const uint16_t *x , byte len)
{ unsigned int buffer[100];
 for (byte i=0; i < len; i++) {
   buffer[i] = pgm_read_word( (x+i) );
 }
irsend.sendRaw(buffer, len, 38);
}


void setup()
{
 Serial.begin(9600);
}

void loop(){

 while (Serial.available()){
 delay(3);
 char c = Serial.read();
 readString +=c;
 }
 
 if (readString.length() >0){
   Serial.println(readString);
   
     
   
   if ( readString=="DELONGHIon"){
         ReadFlash(on, VDIM(on)) );}
   
   
   if ( readString=="DELONGHIcondsuper"){
         ReadFlash(condsuper, VDIM(condsuper))) ;}
   
   
   if ( readString=="DELONGHIcondalta"){
         ReadFlash(condalt, VDIM(condalt))) ;}
  if ( readString=="DELONGHIcondmedia" ){
         ReadFlash(condmed, VDIM(condmed)) );}
   
   if ( readString=="DELONGHIcondbassa"){
         ReadFlash(condbas, VDIM(condbas) ));}
         
          if ( readString=="DELONGHIriscalta"){
         ReadFlash(riscalt, VDIM(riscalt) ));}
   
   
   
   
     
     
     
     readString="";
 }
}



Ho risolto e modificato il codice!!  :P :P

Go Up