Hi there i'm trying to make a project using arduino, Wifly and a GPU screen by vizic technologies, but i'm getting troubles by using TimerOne library, it says i have expected unqualified-id before numeric constant at the library TimerOne.h here's the code:
#include <Arduino.h>
#include <Streaming.h>
#include <SoftwareSerial.h>
#include "WiFlySerial.h"
#include "MemoryFree.h"
#include "Credentials.h"
#include <SMARTGPU.h>
#include <TimerOne.h>
// Pins are 3 for INCOMING TO Arduino, 5 for OUTGOING TO Wifly
// Arduino WiFly
// 2 - receive TX (Send from Wifly, Receive to Arduino)
// 3 - send RX (Send from Arduino, Receive to WiFly)
WiFlySerial WiFly(2,3);
SMARTGPU lcd;
#define REQUEST_BUFFER_SIZE 120
#define HEADER_BUFFER_SIZE 150
#define BODY_BUFFER_SIZE 100
char bufRequest[REQUEST_BUFFER_SIZE];
char bufHeader[HEADER_BUFFER_SIZE];
char bufBody[BODY_BUFFER_SIZE];
int remPort = 3000;
boolean isConn = false;
int touch[2];
int res =0;
boolean Touch = true;
char t[5];
char none[] = {'N','O','N','E','O'};
boolean isNone = true;
int i;
int line = 0, offset = 10, height = 16;
//SETUP
void setup(){
////////////////////////////CONFIG WIFLY/////////////////////////////////
Timer1.detachInterrupt();
Serial.begin(9600);
lcd.init(); //Cnfigura el puerto serial y los pines para el SMARTGPU
lcd.start(); //Inicializa el SMARTGPU
printLCD( "GPU OK" );
WiFly.begin();
printLCD( "Configuring WiFly..." );
WiFly.setAuthMode( WIFLY_AUTH_OPEN );
WiFly.setJoinMode( WIFLY_JOIN_AUTO );
WiFly.setDHCPMode( WIFLY_DHCP_ON );
WiFly.setSSID( ssid );
WiFly.SendCommand("set comm remote h",">", bufBody, BODY_BUFFER_SIZE);
WiFly.SendCommand("set ip host 10.25.74.172",">", bufBody, BODY_BUFFER_SIZE);
WiFly.SendCommand("set sys autoconn 2",">", bufBody, BODY_BUFFER_SIZE);
WiFly.SendCommand("set ip flags 0x6",">", bufBody, BODY_BUFFER_SIZE);
WiFly.setRemotePort(remPort);
// If not joined restart link
printLCD( "Checking WiFly status..." );
WiFly.getDeviceStatus();
if (!WiFly.isifUp() ) {
printLCD( "WiFly if is not up. Joining..." );
if ( WiFly.join() ) {
printLCD( "WiFly joined." );
//WiFly.setNTP( ntp_server ); // use your favorite NTP server
} else {
printLCD( "WiFly join FAIL." );
}
} // if not connected
printLCD( "WiFly OK" );
printLCD( WiFly.getIP(bufRequest, REQUEST_BUFFER_SIZE));
printLCD( "Opening TCP connection...");
WiFly.SendCommand("close",">", bufBody, BODY_BUFFER_SIZE);
memset (bufBody,'\0',BODY_BUFFER_SIZE);
delay(3000);
lcd.erase();
}
void printLCD( char* text ) {
lcd.string( offset, nextLine(), 320-offset, 240-offset, WHITE, FONT3, TRANS, text );
}
int nextLine() {
if( (line+1)*height > 240-offset ) {
line = 0;
lcd.erase();
}
return offset + (line++)*height;
}
/// METODOS PARA LOS DIFERENTES CASOS////
void DISPLAY(){
lcd.erase();
WiFly.write('L');
}
void TOUCH(){
Timer1.initialize(1000000);
Timer1.attachInterrupt( ISR_PollWiFly );
while(true) {
while(lcd.touchScreen(touch)==0);
for( i = 0 ; i < 5; i++) {
WiFly.write(t[i]); //Manda las coordenadas
}
DISPLAY();
}
Timer1.detachInterrupt();
WiFly.write('S');
}
void WriteGPU(){
char g;
g = WiFly.read();
Serial.print(g);
}
void dibujarFondo() {
lcd.imageSD(0,0,"TEC");
lcd.string(30,10,310,220,CYAN,FONT3,TRANS,"Centro de Desarrollo Estudiantil");
lcd.string(80,30,310,220,CYAN,FONT3,TRANS,"Ofertas de trabajo");
lcd.drawRectangle(10,50,310,100,WHITE,FILL);
lcd.drawRectangle(10,110,310,160,CYAN,FILL);
lcd.drawRectangle(10,170,310,220,0xF805,FILL);
}
void ISR_PollWiFly(){
char c;
while(WiFly.available()) {
c = WiFly.read();
if(c == 's') {
DISPLAY();
}
}
}
////////////////////////////////////// MAIN //////////////////////////////////////
void loop(){
lcd.baudChange(2000000);
char c;
c = WiFly.read();
switch(c){
case 'q':
DISPLAY();
break;
case 't':
TOUCH();
break;
case 'g':
WriteGPU();
break;
case 'f':
dibujarFondo();
break;
default:
break;
}
}