-->
Page 1 of 1

need help: "graphicsLCD" library and display SSID & IP

PostPosted: Sun Jan 31, 2016 4:34 am
by akhgari
Hi
I use graphicsLCD library to work with lcd nokia 1202 with STE2007. it's same as nokia 1100(PCF8814).
this library work fine but I don't know how to print SSID and IP on lcd. my code is:
Code: Select all#include <ESP8266WiFi.h>
#include <graphicsLCD.h>

// WiFi parameters
const char* ssid = "xxx_yyy";
const char* password = "abcdefg";

// Create an instance of the server
WiFiServer server(80);

#define lcd_RST_pin 12
#define lcd_CS_pin 13
#define lcd_DIN_pin 14
#define lcd_CLK_pin 15

graphicsLCD lcd(lcd_RST_pin, lcd_CS_pin, lcd_DIN_pin, lcd_CLK_pin);


void setup()
{
  lcd.begin();
  lcd.clear();
  // Connect to WiFi network
  lcd.line(0);
  lcd.print("Connecting to ");
  lcd.print(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    lcd.print(".");
  }
  delay (3000);
  lcd.clear();
  lcd.print("WiFi connected");

  // Start the server
  server.begin();
  lcd.clear();
  lcd.print("Server started");
  // Print the IP address
  lcd.line(1);
  IPAddress ip = WiFi.localIP();
  lcd.print(ip);
  delay (3000);
}

void loop()
{

}


and compile with some error

Demo_whit_1202:26: error: call of overloaded 'print(const char*&)' is ambiguous

lcd.print(ssid);


and when disable line26
Code: Select alllcd.print(ssid);

then compile but show IP like "67217600" instead of "192:168:1:4"

thanks to help me.

Re: need help: "graphicsLCD" library and display SSID & IP

PostPosted: Sun Jan 31, 2016 12:27 pm
by martinayotte
This is because you are printing the pointer of the IPAddress object.
you should print it like that :
Code: Select alllcd.print(ip.toString().c_str());