problem with email notifier

i am making a email notifier but i am getting an error whem compiling could somebody please help me out??? i am using an arduino mega

here is my code:

include

include "fonts/Arial14.h"

include "fonts/SystemFont5x7.h"

byte counter='0'; //new emails counter byte prevCounter='0'; //previous new emails counter int backlight = 10;

void backlightBlink(){ //draws your attention to the screen int pwm,i; for(i=0;i<2;i++){ for(pwm=255;pwm>0;pwm--) {analogWrite(backlight,pwm); delay(2);} for(pwm=0;pwm<256;pwm++) {analogWrite(backlight,pwm); delay(2);} } }

void setup(){ Serial.begin(9600); GLCD.Printf("ArduGmail Notifier"); GLCD.GotoXY(2,2); GLCD.Printf("new messages"); GLCD.GotoXY(0,2); GLCD.Printf(counter); analogWrite(backlight,255); //maximum backlight }

void loop(){

if (Serial.available()>0){ //python script sends only one character so the number of unread mails can be zero up to nine

prevCounter= counter; counter = Serial.read(); GLCD.GotoXY(0,2); GLCD.Printf(counter);

if (int(counter) > int(prevCounter)) {backlightBlink();} //draws your attention } }

and here is the error:

arduGmailNotifier.cpp: In function 'void setup()': arduGmailNotifier:22: error: invalid conversion from 'byte' to 'const char*' arduGmailNotifier:22: error: initializing argument 1 of 'void gText::Printf(const char*, ...)' arduGmailNotifier.cpp: In function 'void loop()': arduGmailNotifier:33: error: invalid conversion from 'byte' to 'const char*' arduGmailNotifier:33: error: initializing argument 1 of 'void gText::Printf(const char*, ...)'

thank you very very much if you could help me out

byte counter='0';   //new emails counter

Do you really want to set "counter" to 48? Not zero?

already found the problem :D

i thought i had found the problem…
almost everything works now but as AWOL said

i am getting the message that i have 48 new messages but i am sure i haven’t got any new message.
i tried a few adjusments now but i am still getting 48 messages how could i solve this ?

ps. here is the new code:

#include <glcd.h>
#include “fonts/Arial14.h”
#include “fonts/SystemFont5x7.h”

byte counter=‘0’; //new emails counter
byte prevCounter=‘0’; //previous new emails counter
int backlight = 10;

void backlightBlink(){ //draws your attention to the screen
int pwm,i;
for(i=0;i<2;i++){
for(pwm=255;pwm>0;pwm–) {analogWrite(backlight,pwm); delay(2);}
for(pwm=0;pwm<256;pwm++) {analogWrite(backlight,pwm); delay(2);}
}
}

void setup(){
Serial.begin(9600);
GLCD.SelectFont(System5x7);

GLCD.Init(NON_INVERTED); // initialise the library

GLCD.Puts(“ArduGmail Notifier”);
delay(1000);

GLCD.GotoXY(32,30);
GLCD.Puts(" new messages");

GLCD.GotoXY(32,30);
GLCD.PrintNumber(counter);

analogWrite(backlight,255); //maximum backlight
}

void loop(){

if (Serial.available()>0){ //python script sends only one character so the number of unread mails can be zero up to nine

prevCounter= counter;
counter = Serial.read();
GLCD.GotoXY(32,30);
GLCD.PrintNumber(counter);

if (int(counter) > int(prevCounter)) {backlightBlink();} //draws your attention
}
}

This : byte counter=‘0’;
should be: byte counter=0;

The same with the line just under it

cas2406: almost everything works now but as AWOL said ... i am getting the message that i have 48 new messages but i am sure I haven't got any new message.

You answered it yourself - AWOL already mentioned you are using 48 not 0 in two lines:

byte counter='0'; //new emails counter byte prevCounter='0'; //previous new emails counter

in both these cases, '0' is not zero, it's the ASCII character '0', which is different to the computer - and as a number value it's not 0, but 48 (as AWL pointed out). Change both to:

byte counter=0; //new emails counter byte prevCounter=0; //previous new emails counter

Without the quotes, and you be using 0 - so no more 48 emails to start...

MikMo: This : byte counter='0'; should be: byte counter=0; The same with the line just under it

Oops - and as MikMo said (simultaneous posting)

he guys
thank you very much for the quick response i have fixed it now.
when i now start up the arduino, the GLCD first shows i have “0 new messages” but when i then start up the python program
the display says i have 53 new messages although python says i have only 4 new messages, and python is correct.
i think it will probably be the ASCII table again but i am not sure and don’t quite know how that works.
if somebody could help me out i would be really happy

If 48 == '0', then 49 == '1', 50 == '2', 51 == '3', and 52 == '4'. It would appear that you are getting a string for the number, and treating it as a number. Send your self a few e-mails, or wait a bit, and see what happens when you have more than 9.