Hi surferTim, really appreciate you effort to help on this. I have spent countless hours on it. And I feel i am getting pretty close at this point, because of your help.
Changing the pins on the "..wifi.h" file didn't help. I tried various combinations of pins but no success. But i think it should have, so i have to believe maybe there is something wrong with the code or something I am not seeing. I tried the switch on the wifi shield at SW and HW.. The HW seemed to bring up a lot of errors about failure to communicate with programmer.
BTW, everything else, works.. ie the LCD, temperature and Barometric Pressure, and the voltmeter on the 9v battery i have that i am using in place of a 12v battery. I do have a voltage divider on the breadboard, so i am not taking in too many volts.
At one time i tested it on the uno with everything hooked up but the LCD and it worked. so, i have to think there might be still something going on with the LCD and the WIFI.
I have 'xxx' out the wifi and passwords.. etc.. for privacy. they are filled in correctly in actual code.
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
#include <SparkFunESP8266WiFi.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>
//////////////////////////////
// WiFi Network Definitions //
///////////////////////////
const char mySSID[] = "xxxxx";
const char myPSK[] = "xxxxx";
const char* myserver = "www.xxxxx.com";
// Global variables
unsigned long startTime;
float onehour; //holds the value of pressure
unsigned long lastonehour; //tracks the millis since updated
float onehourvalue; //holds the value of pressure
unsigned long fourhour;
unsigned long eighthour;
unsigned long twofourhour;
unsigned long mytime;
float currentpressure;
boolean gotonetwork = false;
// vars for battery readings
int analogInput = 0;
float vout = 0.0;
float vin = 0.0;
float R1 = 220;
float R2 = 10;
int value = 0;
// end vars for batt readings
// end global vars
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(30, 32, 34, 36, 38, 40);
Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);
// wifi functions --------------------------------------------------
void connectESP8266(){
Serial.println("connect called");
int retVal = esp8266.status();
if (retVal <= 0) {
Serial.print("Connecting to ");
Serial.println(mySSID);
retVal = esp8266.connect(mySSID, myPSK);
Serial.println("Error connecting - trying again!");
Serial.println(retVal);
}
if (retVal > 0){
gotonetwork=true;
displayConnectInfo();
}
}
void displayConnectInfo(){
char connectedSSID[24];
memset(connectedSSID, 0, 24);
int retVal = esp8266.getAP(connectedSSID);
if (retVal > 0) {
Serial.print("Connected to: ");
Serial.println(connectedSSID);
IPAddress myIP = esp8266.localIP();
Serial.print("My IP: ");
Serial.println(myIP);
delay(2000);
clientDemo();
}
}
void clientDemo(){
ESP8266Client client;
int retVal = client.connect(myserver, 80);
delay(4000);
if (retVal <= 0) {
Serial.println("Failed to connect to server.");
//return;
}
if (retVal > 0) {
Serial.println("Connected to server.");
}
Serial.println("Making HTTP CALL: ");
client.print(String("GET ") + "/cgi-bin/temperature.php?apples=69" + " HTTP/1.1\r\n" +
"Host: " + "www.xxxx.com" + "\r\n" +
"Connection: keep-alive\r\n\r\n");
Serial.println("http request has been made");
while (client.available()){
Serial.write(client.read()); // read() gets the FIFO char
}
if (client.connected()){
client.stop(); // stop() closes a TCP connection.
}
}
// end wifi functions --------------------------------------------
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print("Monitor ");
if(!bmp.begin()) {
Serial.print("Ooops, no BMP085 detected ... Check your wiring or I2C ADDR!");
//while(1);
}
// wifi setup =========================================
esp8266.begin();
connectESP8266();
// end wifi setup ====================================
startTime = millis();
lastonehour = startTime;
// voltmeter setup =========================
pinMode(analogInput, INPUT);
// end voltmeter setup ---------------
}
void loop() {
sensors_event_t event;
bmp.getEvent(&event);
if (event.pressure){
Serial.print("Pressure: ");
Serial.print(event.pressure);
Serial.println(" hPa");
if (millis() < 4000){
Serial.println(millis());
currentpressure = event.pressure;
Serial.println(event.pressure);
}
float temperature;
bmp.getTemperature(&temperature);
temperature = (temperature * 9/5) + 32;
Serial.print("Temp: ");
Serial.print(temperature);
Serial.println(" F");
lcd.setCursor(0, 0);
lcd.print(" ");
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(temperature);
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print("Pres: ");
lcd.print(event.pressure);
//lcd.print(" hPa");
//String mystring = String(temperature + " myst " + event.pressure);
//Serial.print(mystring);
} else {
Serial.println("Sensor error");
}
delay(8000);
mytime = millis() - lastonehour;
if(mytime >= 3600000){
onehourvalue = currentpressure;
currentpressure = event.pressure;
lastonehour = millis();
}
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print("1 hr: ");
if(onehourvalue > currentpressure){
lcd.print(onehourvalue);
lcd.print(" dn ");
}else{
lcd.print(onehourvalue);
lcd.print(" up ");
}
// voltmeter loop stuff
value = analogRead(analogInput);
Serial.print("volts into arduino:");
Serial.println(value);
vout = (value * 5.0) / 1024.0; // see text
vin = vout / (R2/(R1+R2));
if (vin<11) {
//vin=0.0;//statement to quash undesired reading !
lcd.setCursor(0,1);
lcd.print("Batts are LOW!");
delay(5000);
}
lcd.setCursor(0, 1);
lcd.print("Boat DC = ");
lcd.print(vin);
delay(5000);
// end voltmeter stuff
}