Почему не работает скетч (ошибок при компиляции нет)
- Войдите на сайт для отправки комментариев
Вс, 29/03/2015 - 02:17
Помогите разобратся. Скетч для управления телевизором через ИК-порт. Скетч простой, написал через оператор if . Всего 20 команд. Но что странно, команды с 1 по 15 работают без проблем (только при условии если закоментировать с 16 по 20). Если подключить 16, то сериал порт выдает абракатабру. А если включить все 20, то arduino вообще молчит. Попробуйте у себя поотсылать команды с 1 по 20. Спасибо
#include <IRremote.h>
IRsend irsend;
void setup()
{
Serial.begin(9600);
}
void loop() {
unsigned int power[68] = {4450, 4350, 650, 1600, 600, 1600, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 500, 600, 500, 650, 1600, 600, 1600, 600, 1600, 650, 450, 650, 500, 600, 500, 600, 500, 650, 500, 600, 500, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 500, 600, 1600, 650, 1600, 600, 1600, 600, 1600, 600, 1600, 650, 1600, 600};
unsigned int button1[68] = {4500, 4350, 600, 1600, 650, 1550, 600, 1650, 600, 500, 600, 500, 600, 500, 650, 450, 650, 500, 650, 1550, 650, 1550, 650, 1600, 600, 500, 650, 450, 650, 450, 650, 500, 600, 500, 650, 450, 650, 450, 650, 1600, 600, 500, 650, 450, 650, 450, 650, 500, 600, 500, 650, 1550, 600, 1600, 650, 500, 600, 1600, 600, 1600, 650, 1550, 650, 1600, 600, 1600, 650};
unsigned int button2[68] = {4500, 4350, 650, 1550, 650, 1550, 650, 1600, 650, 450, 600, 500, 650, 500, 600, 500, 650, 450, 650, 1550, 650, 1600, 600, 1600, 600, 500, 650, 450, 650, 500, 600, 500, 650, 450, 650, 1550, 650, 500, 600, 1600, 650, 450, 600, 500, 650, 500, 600, 500, 650, 450, 650, 450, 650, 1600, 650, 450, 650, 1550, 650, 1600, 600, 1600, 650, 1550, 650, 1550, 650};
unsigned int button3[68] = {4500, 4300, 650, 1550, 650, 1600, 650, 1550, 650, 450, 650, 500, 600, 500, 600, 500, 600, 500, 650, 1600, 600, 1600, 650, 1550, 650, 450, 650, 500, 600, 500, 650, 450, 650, 450, 650, 500, 600, 1600, 600, 1600, 600, 500, 650, 500, 600, 500, 650, 450, 650, 450, 650, 1600, 600, 500, 650, 450, 650, 1600, 600, 1600, 650, 1550, 650, 1550, 650, 1600, 600};
unsigned int button4[68] = {4450, 4350, 650, 1600, 600, 1600, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 500, 650, 450, 650, 1600, 600, 1600, 600, 1600, 650, 500, 600, 500, 600, 500, 600, 500, 650, 500, 600, 500, 600, 500, 600, 500, 650, 1600, 600, 500, 650, 450, 650, 450, 650, 500, 600, 1600, 600, 1600, 600, 1600, 650, 500, 600, 1600, 600, 1600, 650, 1550, 650, 1600, 600};
unsigned int button5[68] = {4500, 4300, 650, 1600, 600, 1600, 600, 1600, 600, 500, 650, 500, 650, 450, 650, 450, 650, 450, 650, 1600, 600, 1600, 600, 1600, 650, 500, 600, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 500, 650, 450, 650, 1600, 600, 500, 650, 450, 650, 450, 650, 500, 600, 500, 600, 1600, 600, 1600, 650, 500, 600, 1600, 600, 1600, 650, 1550, 650, 1600, 600};
unsigned int button6[68] = {4500, 4350, 600, 1600, 650, 1550, 650, 1600, 600, 500, 600, 500, 650, 450, 650, 500, 600, 500, 600, 1600, 650, 1600, 600, 1600, 600, 500, 600, 500, 650, 500, 600, 500, 600, 500, 650, 450, 650, 1600, 600, 500, 600, 1600, 600, 500, 650, 500, 600, 500, 650, 450, 600, 1600, 650, 500, 600, 1600, 650, 450, 650, 1550, 650, 1600, 600, 1600, 600, 1600, 650};
unsigned int button7[68] = {4500, 4350, 650, 1600, 600, 1600, 600, 1600, 650, 450, 650, 450, 650, 500, 600, 500, 650, 450, 650, 1550, 650, 1600, 600, 1600, 650, 450, 650, 450, 650, 500, 600, 500, 650, 450, 650, 450, 650, 500, 600, 1600, 650, 1550, 650, 450, 650, 500, 650, 450, 650, 450, 650, 1600, 600, 1600, 650, 450, 650, 450, 650, 1600, 600, 1600, 650, 1550, 650, 1600, 600};
unsigned int button8[68] = {4500, 4300, 650, 1600, 600, 1600, 600, 1600, 600, 500, 650, 500, 600, 500, 650, 450, 600, 500, 650, 1600, 600, 1600, 650, 1550, 600, 500, 650, 500, 600, 500, 600, 500, 650, 450, 650, 1600, 600, 500, 600, 1600, 650, 1550, 650, 500, 600, 500, 600, 500, 650, 500, 600, 500, 650, 1550, 650, 450, 650, 500, 600, 1600, 600, 1600, 650, 1600, 600, 1600, 600};
unsigned int button9[68] = {4500, 4350, 600, 1600, 600, 1600, 600, 1600, 650, 500, 600, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 1600, 600, 1600, 650, 500, 600, 500, 600, 500, 650, 450, 650, 500, 600, 500, 600, 1600, 650, 1600, 600, 1600, 600, 500, 600, 500, 650, 500, 600, 500, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 1600, 600, 1600, 650, 1600, 600, 1600, 600};
unsigned int bitForChanel[68] = {4450, 4350, 600, 1600, 650, 1600, 600, 1600, 650, 450, 650, 450, 650, 500, 650, 450, 600, 500, 650, 1600, 600, 1600, 650, 1550, 600, 500, 650, 500, 600, 500, 650, 450, 650, 450, 650, 1600, 600, 1600, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 500, 650, 450, 650, 500, 600, 500, 600, 1600, 650, 1600, 600, 1600, 600, 500, 600, 1600, 650, 1600, 600};
unsigned int button0[68] = {4500, 4350, 600, 1650, 600, 1600, 600, 1600, 600, 500, 600, 500, 650, 500, 600, 500, 600, 500, 600, 1600, 650, 1600, 600, 1600, 600, 500, 600, 500, 650, 500, 600, 500, 600, 500, 650, 1550, 650, 500, 600, 500, 600, 500, 650, 1600, 600, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 1600, 600, 1600, 650, 500, 600, 1600, 600, 1600, 600, 1600, 650};
unsigned int volumeUp[68] = {4500, 4300, 650, 1600, 600, 1600, 600, 1600, 600, 500, 650, 500, 600, 500, 650, 450, 650, 450, 650, 1600, 600, 1600, 650, 1550, 650, 450, 650, 500, 600, 500, 600, 500, 650, 450, 650, 1600, 600, 1600, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 500, 650, 450, 650, 500, 600, 500, 650, 450, 650, 1600, 600, 1600, 600, 1600, 650, 1550, 650, 1600, 600};
unsigned int chanelUp[68] = {4500, 4350, 650, 1550, 650, 1550, 650, 1600, 600, 500, 600, 500, 600, 500, 650, 500, 600, 500, 650, 1550, 600, 1600, 650, 1600, 600, 500, 650, 450, 600, 500, 650, 500, 600, 500, 600, 500, 650, 1550, 650, 500, 600, 500, 650, 1550, 650, 450, 650, 500, 600, 500, 650, 1550, 650, 500, 600, 1600, 600, 1600, 600, 500, 650, 1600, 600, 1600, 600, 1600, 650};
unsigned int volumeDown[68] = {4450, 4350, 650, 1600, 600, 1600, 600, 1600, 650, 500, 600, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 1600, 600, 1600, 650, 500, 600, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 1600, 600, 500, 650, 1600, 600, 500, 600, 500, 600, 500, 650, 500, 600, 500, 600, 500, 650, 1550, 650, 500, 600, 1600, 600, 1600, 650, 1600, 600, 1600, 600};
unsigned int chanelDown[68] = {4450, 4350, 650, 1600, 600, 1600, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 500, 650, 450, 650, 1600, 600, 1600, 600, 1600, 650, 450, 650, 500, 600, 500, 600, 500, 650, 500, 600, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 1600, 600, 1600, 650, 1600, 600, 500, 600, 1600, 600, 1650, 600, 1600, 600};
int numberOfChanel;
while (Serial.available() == 0);
numberOfChanel = Serial.parseInt();
if (numberOfChanel >= 1 && numberOfChanel <= 20) {
Serial.print("Chanel ");
Serial.print(numberOfChanel);
Serial.println(" is ON");
if (numberOfChanel ==1){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button2, 68, 38);
delay(100);
irsend.sendRaw(button0, 68, 38);
delay(500);
}
if (numberOfChanel ==2){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button2, 68, 38);
delay(500);
irsend.sendRaw(button1, 68, 38);
delay(500);
}
if (numberOfChanel ==3){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button2, 68, 38);
delay(500);
irsend.sendRaw(button2, 68, 38);
delay(500);
}
if (numberOfChanel ==4){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button2, 68, 38);
delay(100);
irsend.sendRaw(button3, 68, 38);
delay(500);
}
if (numberOfChanel ==5){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button2, 68, 38);
delay(100);
irsend.sendRaw(button4, 68, 38);
delay(500);
}
if (numberOfChanel ==6){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button2, 68, 38);
delay(100);
irsend.sendRaw(button5, 68, 38);
delay(500);
}
if (numberOfChanel ==7){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button2, 68, 38);
delay(100);
irsend.sendRaw(button6, 68, 38);
delay(500);
}
if (numberOfChanel ==8){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button2, 68, 38);
delay(100);
irsend.sendRaw(button7, 68, 38);
delay(500);
}
if (numberOfChanel ==9){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button2, 68, 38);
delay(100);
irsend.sendRaw(button8, 68, 38);
delay(500);
}
if (numberOfChanel ==10){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button2, 68, 38);
delay(100);
irsend.sendRaw(button9, 68, 38);
delay(500);
}
if (numberOfChanel ==11){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button3, 68, 38);
delay(100);
irsend.sendRaw(button0, 68, 38);
delay(500);
}
if (numberOfChanel ==12){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button3, 68, 38);
delay(100);
irsend.sendRaw(button1, 68, 38);
delay(500);
}
if (numberOfChanel ==13){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button3, 68, 38);
delay(100);
irsend.sendRaw(button2, 68, 38);
delay(500);
}
if (numberOfChanel ==14){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button3, 68, 38);
delay(500);
irsend.sendRaw(button3, 68, 38);
delay(500);
}
if (numberOfChanel ==15){
Serial.println("send OK");
irsend.sendRaw(bitForChanel, 68, 38);
delay(200);
irsend.sendRaw(button3, 68, 38);
delay(500);
irsend.sendRaw(button4, 68, 38);
delay(500);
}
if (numberOfChanel ==16){
delay(100);
Serial.println("send OK");
irsend.sendRaw(power, 68, 38);
}
if (numberOfChanel ==17){
Serial.print(numberOfChanel);
Serial.println(" is ON");
irsend.sendRaw(chanelUp, 68, 38);
}
if (numberOfChanel ==18){
Serial.print(numberOfChanel);
Serial.println(" is ON");
irsend.sendRaw(chanelDown, 68, 38);
}
if (numberOfChanel ==19){
Serial.print(numberOfChanel);
Serial.println(" is ON");
irsend.sendRaw(volumeDown, 68, 38);
}
if (numberOfChanel ==20){
Serial.print(numberOfChanel);
Serial.println(" is ON");
irsend.sendRaw(volumeUp, 68, 38);
}
}
else {
Serial.println("Invalid !!!");
Serial.println(numberOfChanel);
}
}
Вынеси объявление масивов из loop в глобальные (перед объявлением setup) и добавь PROGMEM чтоб разместить их во флеши.
Вынеси объявление масивов из loop в глобальные (перед объявлением setup) и добавь PROGMEM чтоб разместить их во флеши.
PROGMEM очень полезная штука. Большое спасибо за совет! Все работает .
Как-то так получилось
#include <IRremote.h> #include <avr/pgmspace.h> IRsend irsend; const PROGMEM uint16_t buttons[16][68] = { {4500, 4350, 600, 1650, 600, 1600, 600, 1600, 600, 500, 600, 500, 650, 500, 600, 500, 600, 500, 600, 1600, 650, 1600, 600, 1600, 600, 500, 600, 500, 650, 500, 600, 500, 600, 500, 650, 1550, 650, 500, 600, 500, 600, 500, 650, 1600, 600, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 1600, 600, 1600, 650, 500, 600, 1600, 600, 1600, 600, 1600, 650}, {4500, 4350, 600, 1600, 650, 1550, 600, 1650, 600, 500, 600, 500, 600, 500, 650, 450, 650, 500, 650, 1550, 650, 1550, 650, 1600, 600, 500, 650, 450, 650, 450, 650, 500, 600, 500, 650, 450, 650, 450, 650, 1600, 600, 500, 650, 450, 650, 450, 650, 500, 600, 500, 650, 1550, 600, 1600, 650, 500, 600, 1600, 600, 1600, 650, 1550, 650, 1600, 600, 1600, 650}, {4500, 4350, 650, 1550, 650, 1550, 650, 1600, 650, 450, 600, 500, 650, 500, 600, 500, 650, 450, 650, 1550, 650, 1600, 600, 1600, 600, 500, 650, 450, 650, 500, 600, 500, 650, 450, 650, 1550, 650, 500, 600, 1600, 650, 450, 600, 500, 650, 500, 600, 500, 650, 450, 650, 450, 650, 1600, 650, 450, 650, 1550, 650, 1600, 600, 1600, 650, 1550, 650, 1550, 650}, {4500, 4300, 650, 1550, 650, 1600, 650, 1550, 650, 450, 650, 500, 600, 500, 600, 500, 600, 500, 650, 1600, 600, 1600, 650, 1550, 650, 450, 650, 500, 600, 500, 650, 450, 650, 450, 650, 500, 600, 1600, 600, 1600, 600, 500, 650, 500, 600, 500, 650, 450, 650, 450, 650, 1600, 600, 500, 650, 450, 650, 1600, 600, 1600, 650, 1550, 650, 1550, 650, 1600, 600}, {4450, 4350, 650, 1600, 600, 1600, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 500, 650, 450, 650, 1600, 600, 1600, 600, 1600, 650, 500, 600, 500, 600, 500, 600, 500, 650, 500, 600, 500, 600, 500, 600, 500, 650, 1600, 600, 500, 650, 450, 650, 450, 650, 500, 600, 1600, 600, 1600, 600, 1600, 650, 500, 600, 1600, 600, 1600, 650, 1550, 650, 1600, 600}, {4500, 4300, 650, 1600, 600, 1600, 600, 1600, 600, 500, 650, 500, 650, 450, 650, 450, 650, 450, 650, 1600, 600, 1600, 600, 1600, 650, 500, 600, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 500, 650, 450, 650, 1600, 600, 500, 650, 450, 650, 450, 650, 500, 600, 500, 600, 1600, 600, 1600, 650, 500, 600, 1600, 600, 1600, 650, 1550, 650, 1600, 600}, {4500, 4350, 600, 1600, 650, 1550, 650, 1600, 600, 500, 600, 500, 650, 450, 650, 500, 600, 500, 600, 1600, 650, 1600, 600, 1600, 600, 500, 600, 500, 650, 500, 600, 500, 600, 500, 650, 450, 650, 1600, 600, 500, 600, 1600, 600, 500, 650, 500, 600, 500, 650, 450, 600, 1600, 650, 500, 600, 1600, 650, 450, 650, 1550, 650, 1600, 600, 1600, 600, 1600, 650}, {4500, 4350, 650, 1600, 600, 1600, 600, 1600, 650, 450, 650, 450, 650, 500, 600, 500, 650, 450, 650, 1550, 650, 1600, 600, 1600, 650, 450, 650, 450, 650, 500, 600, 500, 650, 450, 650, 450, 650, 500, 600, 1600, 650, 1550, 650, 450, 650, 500, 650, 450, 650, 450, 650, 1600, 600, 1600, 650, 450, 650, 450, 650, 1600, 600, 1600, 650, 1550, 650, 1600, 600}, {4500, 4300, 650, 1600, 600, 1600, 600, 1600, 600, 500, 650, 500, 600, 500, 650, 450, 600, 500, 650, 1600, 600, 1600, 650, 1550, 600, 500, 650, 500, 600, 500, 600, 500, 650, 450, 650, 1600, 600, 500, 600, 1600, 650, 1550, 650, 500, 600, 500, 600, 500, 650, 500, 600, 500, 650, 1550, 650, 450, 650, 500, 600, 1600, 600, 1600, 650, 1600, 600, 1600, 600}, {4500, 4350, 600, 1600, 600, 1600, 600, 1600, 650, 500, 600, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 1600, 600, 1600, 650, 500, 600, 500, 600, 500, 650, 450, 650, 500, 600, 500, 600, 1600, 650, 1600, 600, 1600, 600, 500, 600, 500, 650, 500, 600, 500, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 1600, 600, 1600, 650, 1600, 600, 1600, 600}, {4450, 4350, 650, 1600, 600, 1600, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 500, 600, 500, 650, 1600, 600, 1600, 600, 1600, 650, 450, 650, 500, 600, 500, 600, 500, 650, 500, 600, 500, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 500, 600, 1600, 650, 1600, 600, 1600, 600, 1600, 600, 1600, 650, 1600, 600}, {4450, 4350, 600, 1600, 650, 1600, 600, 1600, 650, 450, 650, 450, 650, 500, 650, 450, 600, 500, 650, 1600, 600, 1600, 650, 1550, 600, 500, 650, 500, 600, 500, 650, 450, 650, 450, 650, 1600, 600, 1600, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 500, 650, 450, 650, 500, 600, 500, 600, 1600, 650, 1600, 600, 1600, 600, 500, 600, 1600, 650, 1600, 600}, {4450, 4350, 650, 1600, 600, 1600, 600, 1600, 650, 500, 600, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 1600, 600, 1600, 650, 500, 600, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 1600, 600, 500, 650, 1600, 600, 500, 600, 500, 600, 500, 650, 500, 600, 500, 600, 500, 650, 1550, 650, 500, 600, 1600, 600, 1600, 650, 1600, 600, 1600, 600}, {4450, 4350, 650, 1600, 600, 1600, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 500, 650, 450, 650, 1600, 600, 1600, 600, 1600, 650, 450, 650, 500, 600, 500, 600, 500, 650, 500, 600, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 1600, 600, 1600, 650, 1600, 600, 500, 600, 1600, 600, 1650, 600, 1600, 600}, {4500, 4300, 650, 1600, 600, 1600, 600, 1600, 600, 500, 650, 500, 600, 500, 650, 450, 650, 450, 650, 1600, 600, 1600, 650, 1550, 650, 450, 650, 500, 600, 500, 600, 500, 650, 450, 650, 1600, 600, 1600, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 500, 650, 450, 650, 500, 600, 500, 650, 450, 650, 1600, 600, 1600, 600, 1600, 650, 1550, 650, 1600, 600}, {4500, 4350, 650, 1550, 650, 1550, 650, 1600, 600, 500, 600, 500, 600, 500, 650, 500, 600, 500, 650, 1550, 600, 1600, 650, 1600, 600, 500, 650, 450, 600, 500, 650, 500, 600, 500, 600, 500, 650, 1550, 650, 500, 600, 500, 650, 1550, 650, 450, 650, 500, 600, 500, 650, 1550, 650, 500, 600, 1600, 600, 1600, 600, 500, 650, 1600, 600, 1600, 600, 1600, 650}, }; int i = 0; //count unsigned int buf[68]; unsigned int buf_2[68]; unsigned int buf_3[68]; int numberOfChanel; int x,y,z; void setup() { Serial.begin(9600); } void loop() { if (Serial.available() > 0) { numberOfChanel = Serial.parseInt(); // input command if (numberOfChanel >= 20 && numberOfChanel <= 34) { x=numberOfChanel/10; y=numberOfChanel-x*10; for (i = 0; i <= 67; i++) { buf[i] = pgm_read_word(&(buttons[11][i])); //read buf_2[i] = pgm_read_word(&(buttons[x][i])); //from buf_3[i] = pgm_read_word(&(buttons[y][i])); // flash } delay(50); irsend.sendRaw(buf, 68, 38); delay(200); irsend.sendRaw(buf_2, 68, 38); delay(300); irsend.sendRaw(buf_3, 68, 38);//send command delay(50); Serial.println("send ok "); Serial.print("channel "); Serial.print(numberOfChanel-19); Serial.println(" is ON"); } else { if (numberOfChanel >= 35 && numberOfChanel <= 39) { if (numberOfChanel==35) {x=10;} if (numberOfChanel==36) {x=12;} if (numberOfChanel==37) {x=13;} if (numberOfChanel==38) {x=14;} if (numberOfChanel==39) {x=15;} for (i = 0; i <= 67; i++) {buf[i] = pgm_read_word(&(buttons[x][i]));} //read from flash delay(50); irsend.sendRaw(buf, 68, 38); Serial.println("send ok "); Serial.print("channel "); Serial.print(numberOfChanel-19); Serial.println(" is ON"); } else { Serial.print(" ERROR "); Serial.print(numberOfChanel); Serial.println(" is Invalid !!!"); } } } }