Installation of Arduino Uno R3 plus ESP01S wifi shield.
Trying to start webserver on wifishield with AT Commands from Setup function.
Doing this manually by typing in the serial monitor i get response, but not with "auto" commands.
In the end the arduino will be part of my home automation. Like controlling the Rollo. I need the webserver to communicate with my android phone. Communication by calling IP etc...
The following Code should Work, because "AT" returns "OK". But no answer. And this is my main Problem. When i know how to communicate in a correct way with the Shield, i can do the rest.
#include <AltSoftSerial.h>
// Arduino pin 08 for RX
// Arduino Pin 09 for TX
AltSoftSerial espSerial;
void setup(){
int check = 1;
Serial.begin(9600);
Serial.println("Start");
espSerial.begin(9600);
// Check connection
if (check==1){
Serial.println("Check connection");
espSerial.print("AT");
check = wait4result( "OK", 6000); // wait for esp to return "OK" or timeout after 1s if it doesn't appear.
}
int wait4result(char *s, unsigned short timeout) {
unsigned long tm=millis();
//print Return from ESP
while( millis() - tm <= timeout ) {
if (espSerial.find(s)) { // match result
Serial.println(s);
return 1;
}
}
// send timeout msg to console.
Serial.print(F("TimedOutWaitingFor: "));
Serial.println(s);
return 0;
}
The Loop function is still empty. First i need to get the Basics running.
i connected the components like so in chapter "Setting up a local Server": How to Show Arduino Sensor Data on a Web Page - Circuit Basics but used the pins 8 and 9, because 0 and 1 only work with munally communication and Bare Minimum Sketch . And the library works with 8 and 9 i read somewhere.
ProgrammingSoftware: Arduino IDE
Tool-> Board -> Arduino Uno