Both work, but sometimes the ESP does not start again.
Answer:
pinMode(12, INPUT_PULLUP); // Set pin 12 as an input w/ pull-up | |
while (digitalRead(12) == HIGH) // While pin 12 is HIGH (not activated) | |
yield(); // Do (almost) nothing -- yield to allow ESP8266 background functions | |
Serial.println("Button is pressed!"); // Print button pressed message. |
// id/name, placeholder/prompt, default, length | |
WiFiManagerParameter custom_mqtt_server("server", "mqtt server", mqtt_server, 40); | |
wifiManager.addParameter(&custom_mqtt_server); | |
mqtt_server = custom_mqtt_server.getValue(); |
http.begin("http://192.168.0.104:8080/webappfordemo/Version"); | |
int httpCode = http.GET(); | |
if(httpCode == HTTP_CODE_OK) | |
{ | |
Serial.print("HTTP response code "); | |
Serial.println(httpCode); | |
String response = http.getString(); | |
Serial.println(response); | |
} |
String card = "2-3d-fg-d6-12-68-32-3f-35-45-42-53-2a-3"; | |
char *prefix = "GET /insert.php?card="; | |
char *postfix ="&error=1 HTTP/1.1\r\nHost: testsite.com\r\n\r\n"; | |
String url = prefix +card+ postfix; | |
const char *url_complete = url.c_str(); | |
//... |
Both work, but sometimes the ESP does not start again.
Answer:
reset causes: | |
0: | |
1: normal boot | |
2: reset pin | |
3: software reset | |
4: watchdog reset | |
boot device: | |
0: | |
1: ram |
#include <EEPROM.h> | |
char wifi_ssid_private[32]; | |
char wifi_password_private[32]; | |
char clientName[10] = "newClient"; | |
char ipAddr[16] = "172.024.001.001";//Pi Access Point IP-Adr. | |
//startAdr: offset (bytes), writeString: String to be written to EEPROM | |
void writeEEPROM(int startAdr, int laenge, char* writeString) { | |
EEPROM.begin(512); //Max bytes of eeprom to use |
extern struct MyStruct theVar; |
//The usual arduino workaround/hack is to have all functions that requires custom datatstructures to be placed in an additional .h file. Just create a new tab in the IDE and give it a name.h then #include "name.h" | |
RGB getBlue(); //return RGB color = { 0 , 0 , 255 }; | |
void displayRGB(RGB color); //could call an analogWrite on all member variables |
y = map(x, 1, 50, 50, 1); |