Hi all,
Hi wrote a sketch several months ago on my laptop in the Arduino IDE 1.0.2, which compiled fine (and still does on my laptop).
I tried to compile it today on another PC for which I downloaded the latest stable version of the IDE, 1.5.8.
I'm getting a a lot of error messages, of which the first one is 'prog_char' does not name a type. It seems to have something to do with #include <avr/pgmspace.h>.
The sketch is basically a lot of copy and paste from sketches found online.
Any ideas?
Thanks!
Jens
Code:
/*
DATE: 17-06-2014
PROGRAMMING: JENS VANHOOF
COMPILE: Arduino IDE 1.0.2
BOARD: Arduino Ethernet
DESCRIPTION: Hosts a webpage on specified IP-address with buttons LEFT and RIGHT to turn AR-500 from Hygain.
*/
#include <avr/pgmspace.h>
#include <SPI.h>
#include <Ethernet.h>
#include <IRremote.h>
prog_char string_a[] PROGMEM = "<input type=submit value=A style=width:100px;height:45px onClick=location.href='/?a'>";
prog_char string_b[] PROGMEM = "<input type=submit value=B style=width:100px;height:45px onClick=location.href='/?b'>";
prog_char string_c[] PROGMEM = "<input type=submit value=C style=width:100px;height:45px onClick=location.href='/?c'>";
prog_char string_d[] PROGMEM = "<input type=submit value=D style=width:100px;height:45px onClick=location.href='/?d'>";
prog_char string_e[] PROGMEM = "<input type=submit value=E style=width:100px;height:45px onClick=location.href='/?e'>";
prog_char string_f[] PROGMEM = "<input type=submit value=F style=width:100px;height:45px onClick=location.href='/?f'>";
prog_char string_g[] PROGMEM = "<input type=submit value=G style=width:100px;height:45px onClick=location.href='/?g'>";
prog_char string_h[] PROGMEM = "<input type=submit value=H style=width:100px;height:45px onClick=location.href='/?h'>";
prog_char string_i[] PROGMEM = "<input type=submit value=I style=width:100px;height:45px onClick=location.href='/?i'>";
prog_char string_j[] PROGMEM = "<input type=submit value=J style=width:100px;height:45px onClick=location.href='/?j'>";
prog_char string_u[] PROGMEM = "<input type=submit value=U style=width:100px;height:45px onClick=location.href='/?u'>";
prog_char string_l[] PROGMEM = "<input type=submit value=L style=width:100px;height:45px onClick=location.href='/?l'>";
prog_char string_initial[] PROGMEM = "<input type=submit value=Initial style=width:200px;height:45px onClick=location.href='/?y'>";
prog_char string_memory[] PROGMEM = "<input type=submit value=Memory style=width:200px;height:45px onClick=location.href='/?z'>";
prog_char string_left[] PROGMEM = "<input type=submit value=LEFT style=width:200px;height:90px onClick=location.href='/?8'>";
prog_char string_right[] PROGMEM = "<input type=submit value=RIGHT style=width:200px;height:90px onClick=location.href='/?9'>";
PROGMEM const char *string_table[] = // change "string_table" name to suit
{
string_a,
string_b,
string_c,
string_d,
string_e,
string_f,
string_g,
string_h,
string_i,
string_j,
string_u,
string_l,
string_initial,
string_memory,
string_left,
string_right};
char buffer[120];
IRsend irsend;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 255, 10 }; // ip in lan
byte gateway[] = { 192, 168, 255, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port
String readString;
void setup(){
//start Ethernet
Ethernet.begin(mac, ip, gateway, gateway, subnet);
server.begin();
pinMode(2,OUTPUT);
digitalWrite(2,HIGH);
delay(2000);
digitalWrite(2,LOW);
//enable serial data print
Serial.begin(9600);
Serial.println("server multi pin button test 1.0"); // so I can keep track of what is loaded
}
void loop(){
// Create a client connection
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
//read char by char HTTP request
if (readString.length() < 100) {
//store characters to string
readString += c;
//Serial.print(c);
}
//if HTTP request has ended
if (c == '\n') {
///////////////
Serial.println(readString); //print to serial monitor for debuging
client.println("HTTP/1.1 200 OK"); //send new page
client.println("Content-Type: text/html");
client.println();
client.println("<HTML>");
client.println("<HEAD>");
client.println("<TITLE>EuroLinx AR-500 Antenna Rotator</TITLE>");
client.println("</HEAD>");
client.println("<BODY>");
client.println("<H1>AR-500 Antenna Rotator</H1>");
for(int i=14;i<16;i++){
strcpy_P(buffer, (char*)pgm_read_word(&(string_table[i]))); client.print(buffer);}
client.print("
");
for(int i=0;i<4;i++){
strcpy_P(buffer, (char*)pgm_read_word(&(string_table[i]))); client.print(buffer);}
client.print("
");
for(int i=4;i<8;i++){
strcpy_P(buffer, (char*)pgm_read_word(&(string_table[i]))); client.print(buffer);}
client.print("
");
for(int i=8;i<12;i++){
strcpy_P(buffer, (char*)pgm_read_word(&(string_table[i]))); client.print(buffer);}
client.print("
");
for(int i=12;i<14;i++){
strcpy_P(buffer, (char*)pgm_read_word(&(string_table[i]))); client.print(buffer);}
client.print("<p></p>");
client.print("(c) EuroLinx 2014, written by Jens Vanhoof.");
client.println("</BODY>");
client.println("</HTML>");
delay(1);
client.stop();
if(readString.indexOf('8') >0){
for (int i = 0; i < 3; i++) {irsend.sendNEC(0x609F8877,32); delay(40);} //links draaien
}
if(readString.indexOf('9') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609F48B7,32); delay(40);} //rechts draaien
}
if(readString.indexOf('a') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609F20DF,32); delay(40);} //preset A
}
if(readString.indexOf('b') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609FA05F,32); delay(40);} //preset B
}
if(readString.indexOf('c') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609F609F,32); delay(40);} //preset C
}
if(readString.indexOf('d') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609FE01F,32); delay(40);} //preset D
}
if(readString.indexOf('e') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609F10EF,32); delay(40);} //preset E
}
if(readString.indexOf('f') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609F906F,32); delay(40);} //preset F
}
if(readString.indexOf('g') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609F50AF,32); delay(40);} //preset G
}
if(readString.indexOf('h') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609FD02F,32); delay(40);} //preset H
}
if(readString.indexOf('i') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609F30CF,32); delay(40);} //preset I
}
if(readString.indexOf('j') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609FB04F,32); delay(40);} //preset J
}
if(readString.indexOf('u') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609F708F,32); delay(40);} //preset U
}
if(readString.indexOf('l') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609FF00F,32); delay(40);} //preset L
}
if(readString.indexOf('y') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609F08F7,32); delay(40);} //initial
}
if(readString.indexOf('z') >0){
for (int i = 0; i < 3; i++) { irsend.sendNEC(0x609FC837,32); delay(40);} //memory
}
readString="";
digitalWrite(2,HIGH);
delay(100);
digitalWrite(2,LOW);
}
}
}
}
}