I am trying to write a code such that whatever I type in arduino IDE serial monitor is printed on nokia 5110 display
I think the code is right
but during compilation the error that pops up is that, "invalid conversion from 'int' to 'char*' [-fpermissive]"
You have posted your code but you didn't use the requested code tags.
"Post your code here using code tags </>"
Now please go back and edit your reply. Highlight the part that is code and click on the </> icon. It is all the way at the left.
EDIT: I see that you tried to use them but you weren't successful. Make sure the part you want tagged is still highlighted when you click. Also - you can't use 'quick Edit', use 'More' then 'Modify'.
Your code should look like this after you do it correctly:
#include <LCD5110_Graph.h>
LCD5110 lcd(8,9,10,11,12); //create lcd variable and specify pins
extern uint8_t SmallFont[];
void setup() {
Serial.begin(9600); //turn on serial communication at 9600 bps
Serial.print("type what you want to display on nokia 5110 display caution it shouldnt be a number"); //guidance text to display on serial monitor
lcd.InitLCD();//initialize the lcd
lcd.setFont(SmallFont);//set the font
}
void loop() {
if (Serial.available()){
lcd.print(Serial.read(),0,0);//if data is available, read it and send it to display buffer
}
lcd.update();//copy the data from display buffer to the screen
}
It really isn't that difficult. Have you considered reading the forum instructions? Specifically the section titled:
"7. If you are posting code or error messages, use "code" tags"
#include <LCD5110_Graph.h>
LCD5110 lcd(8,9,10,11,12);//create lcd variable and specify pins
extern uint8_t SmallFont[];
void setup() {
Serial.begin(9600);//turn on serial communication at 9600 bps
Serial.print("type what you want to display on nokia 5110 display caution it shouldnt be a number");//guidance text to display on serial monitor
lcd.InitLCD();//initialize the lcd
lcd.setFont(SmallFont);//set the font
}
void loop() {
if (Serial.available()){
lcd.print(Serial.read(),0,0);//if data is available, read it and send it to display buffer
}
lcd.update();//copy the data from display buffer to the screen
}
I just did some research and updated my code
it now uploads without any error but it does not work
my new code is
#include <LCD5110_Graph.h>
LCD5110 lcd(8, 9, 10, 11, 12); //create lcd variable and specify pins
extern uint8_t SmallFont[];
char val = 0;
void setup() {
pinMode(7, OUTPUT);
digitalWrite(7, HIGH);
Serial.begin(9600);//turn on serial communication at 9600 bps
Serial.print("type what you want to display on nokia 5110 display caution it shouldnt be a number");//guidance text to display on serial monitor
lcd.InitLCD();//initialize the lcd
lcd.setFont(SmallFont);//set the font
}
void loop()
{
if (Serial.available())
{
delay(100);
lcd.clrScr();
while (Serial.available()){
char val = Serial.read();
lcd.print(((char*)val),0,0);
}
}
lcd.update();
}