error message when compiling

hello

I’m trying to create a loop where valieas are read from 3 arrays and from frist array I get a IR code to be sent trough a IR led, second array I get a description of the code sent, and 3rd aray I get a delay unitl next IR send. (then I’ll show this 2 last datas in an LCD)

As I’m a very poor and newbie programmer I try to debug troug serial monitor printing the values my loop gets, but I get an error mesagge when compiling that I dont understand;

exit status 1
‘i’ was not declared in this scope

my code is the following:

// libreira irsend
#include <IRremote.h>
IRsend irsend;
// libreria irsend FIN

// codigo de lcd
#include <LCD5110_Basic.h>

LCD5110 myGLCD(7,6,5,4,3);
extern uint8_t SmallFont;
extern uint8_t MediumNumbers;
extern uint8_t BigNumbers;
//codigo lcd FIN

// arrays de datos

int ircode = {0x20DF10EF, 0x20DF8877, 0x20DFD22D, 0x20DFD22D, 0x20DF6897, 0x20DF40BF, 0x20DF40BF, 0x20DF40BF, 0x20DF40BF, 0x20DF00FF, 0x20DF00FF, 0x20DF00FF, 0x20DFC03F, 0x20DFC03F, 0x20DFC03F, 0x20DFC03F, 0x20DFC03F, 0x20DF956A, 0x20DF956A, 0x20DF8877, 0x20DFD22D, 0x20DF10EF};

String ircodename = {“poweron”, “Channel_1”, “channel_list”, “channel_list”, “Channel_6”, “volume_up”, “volume_up”, “volume_up”, “volume_up”, “program_up”, “program_up”, “program_up”, “volume_down”, “volume_down”, “volume_down”, “volume_down”, “volume_down”, “guide”, “guide”, “Channel_1”, “channel_list”, “power”};

int ircodedelayseconds = {60, 5, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 10, 30, 15};

void setup() {
Serial.begin(9600); //solo para verificar que se esta enviando la señal
myGLCD.InitLCD(); // se inicializa el LCD
myGLCD.setContrast(70); // se pone el contraste a 70
}

void loop() {

for (int i=0; i<=20; i++)

Serial.println(i);
irsend.sendNEC(ircode*,32); //envia señar infrarroja de la poscion i del array*

  • Serial.println(“Enviado señal del array”); // imprime por serial que fue enviado*
    _ Serial.println(ircode*); // imprime el valor enviado*_
    _ Serial.println(ircodename*; // imprime el nombre del valor enviado*_

* for (int ircodedelayseconds[]=0; i<=60; i++)*
* {*
* myGLCD.setFont(SmallFont);*
* myGLCD.print(“POWER”,CENTER,0);*
* myGLCD.print(“Time (s) to”, CENTER,10);*
* myGLCD.print(“next command”,CENTER,20);*
* myGLCD.setFont(BigNumbers);*
* myGLCD.printNumI(i,CENTER,30);*
* delay(1000);*
* }*
}
anyone can give me a hint? thanks!

for (int ircodedelayseconds[]=0; i<=60; i++)right there.

Code tags are good. We like code tags

Hi

I think I’ve found the issue, fogot to add “{” on the FOR loop:

for (int i=0; i<=20; i++)
{
Serial.println(i);
irsend.sendNEC(ircode*,32); //envia señar infrarroja de la poscion i del array*

  • Serial.println(“Enviado señal del array”); // imprime por serial que fue enviado*
    _ Serial.println(ircode*); // imprime el valor enviado*_
    _ Serial.println(ircodename*); // imprime el nombre del valor enviado*
    }
    aahah, thanks!_

if anyone is curious, this is the complete working code:

/*
 * This sketch sends troug pin9 in arduno mega 
 * (in one sends it trough pin 3) but weill need to 
 * change the line LCD5110 myGLCD(7,6,5,4,3);
 * based on: http://alumnos.informatica.utem.cl/~srocha/control-universal-con-arduino-utilizando-un-emisor-y-receptor-infrarrojos.html
 * 
 * AND
 * 
 * prints in a nokia 5110 LCD the steps, based on: 
 * 
 * // LCD5110_NumberFonts 
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
// http://www.rinkydinkelectronics.com/library.php?id=44
//
// This program is a demo of the included number-fonts,
// and how to use them.
//
// This program requires a Nokia 5110 LCD module
// and Arduino 1.5.2 (or higher).
//
// It is assumed that the LCD module is connected to
// the following pins.
//      SCK  - Pin 8 CLOCK SIGNAL
//      MOSI - Pin 9 DATA TRANSFER
//      DC   - Pin 10 Register select DATA/COMMAND)
//      RST  - Pin 11 RESET
//      CS   - Pin 12 Chip Select
//
// PINES REALES EN ARDUINO
// 1 VCC
// 2 GND
// 3 SCE conecta al pin 3 de la placa mega
// 4 RST conecta al pin 4 
// 5 D/C conecta al pin 5
// 6 (DN) MOSI conecta al pin 6
// 7 SCLK conecta al pin 7
// 8 LED 
 */

  
// libreira irsend
#include <IRremote.h>
IRsend irsend;
// libreria irsend FIN

// codigo de lcd
#include <LCD5110_Basic.h>

LCD5110 myGLCD(7,6,5,4,3);
extern uint8_t SmallFont[];
extern uint8_t MediumNumbers[];
extern uint8_t BigNumbers[];
//codigo lcd FIN

// arrays de datos
long ircode[] = {0x20DF10EF, 0x20DF8877, 0x20DFD22D, 0x20DFD22D, 0x20DF6897, 0x20DF40BF, 0x20DF40BF, 0x20DF40BF, 0x20DF40BF, 0x20DF00FF, 0x20DF00FF, 0x20DF00FF, 0x20DFC03F, 0x20DFC03F, 0x20DFC03F, 0x20DFC03F, 0x20DFC03F, 0x20DF956A, 0x20DF956A, 0x20DF8877, 0x20DFD22D, 0x20DF10EF};
String ircodename[] = {"Power_ON", "Channel_1", "Channel_list", "Channel_list", "Channel_6", "Volume_up", "Volume_up", "Volume_up", "Volume_up", "Program_up", "Program_up", "Program_up", "Volume_down", "Volume_down", "Volume_down", "Volume_down", "Volume_down", "Guide", "Guide", "Channel_1", "Channel_list", "Power"};
int ircodedelayseconds[] = {60, 5, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 10, 30, 15};


void setup() {
  Serial.begin(9600); //solo para verificar que se esta enviando la señal
  myGLCD.InitLCD(); // se inicializa el LCD
  myGLCD.setContrast(70); // se pone el contraste a 70
  }

void loop() {
          //Serial.println("Starting...."); // FOR DEBUG
int i = 0;

for (int i=0; i<=21; i++)

      {
          // Serial.println(i);
          // Serial.println("Sending Signal...:"); // FOR DEBUG imprime por serial que fue enviado
          // Serial.println(ircodename[i]); // FOR DEBUG imprime el nombre del valor enviado
          // Serial.println(" "); // FOR DEBUG imprime el nombre del valor enviado
          // Serial.println(" "); // FOR DEBUG imprime el nombre del valor enviado
             irsend.sendNEC(ircode[i],32); // SEND IR CODE FROM THE ARRAY, position i

          
          // imprimimos en el LCD
          int delay_sec=ircodedelayseconds[i];
             for (int s=delay_sec; s>=0; s--)
                  {
                  myGLCD.clrScr();
                  myGLCD.setFont(SmallFont);
                  myGLCD.print(ircodename[i],CENTER,0);
                  myGLCD.print("Time (s) to", CENTER,10);
                  myGLCD.print("next command",CENTER,20);
                  myGLCD.setFont(BigNumbers);
                  myGLCD.printNumI(s,CENTER,30);
                  delay(1000);
                  }
      
      
      }

}
void loop() {
          //Serial.println("Starting...."); // FOR DEBUG
int i = 0;

for (int i=0; i<=21; i++)

      {
          // Serial.println(i);

Why do you have two variables with the same name with different scope?

Why are your { not consistently placed?