├── .gitattributes ├── .gitignore ├── Examples ├── ESP │ └── HelloServerOTA │ │ ├── HelloServerOTA.ino │ │ ├── otahelp.h │ │ ├── testcode.h │ │ └── userssid.h └── Teensy │ └── S2FB_Proxy_jan31b.ino ├── HTML └── FirstPage │ ├── banner.htm │ ├── cssfile.css │ ├── index.htm │ ├── main.htm │ ├── menu.htm │ └── style.css └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | -------------------------------------------------------------------------------- /Examples/ESP/HelloServerOTA/HelloServerOTA.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | ADC_MODE(ADC_VCC); // to use getVcc 6 | #include 7 | #include "FS.h" // SPIFFS File System 8 | #include "otahelp.h" // OTA code loading setup from BasicOTA 9 | void setupOTA( void ); 10 | 11 | #include "userssid.h" // Keep SSID and PWD out of github code base 12 | //const char* ssid = "SSID"; 13 | //const char* password = "pwd"; 14 | 15 | // GLOBAL ABUSE 16 | char szBuild[] = "OTA_FS_1.0.83"; // simple debug version string to verify new uploads 17 | 18 | const int ESTOP_TEENSY = 16; 19 | const int ESTOP_PIN = ESTOP_TEENSY; // 4; // If this pin HIGH in setup() then only OTA code runs 20 | const int Bled = 12; 21 | const int Rled = 15; // 14 on ESP and 15 on Serial3 22 | const int Gled = 13; 23 | #define RGB_LEDS 3 24 | uint8_t ledsRGB[ RGB_LEDS ] { Gled, Bled, Rled }; 25 | uint32_t G40cnt = 0; 26 | uint32_t ts0 = 0; 27 | uint32_t ts1 = 0; 28 | String webString = ""; // String to display 29 | String sysString = ""; // String to display 30 | String FirstHeap = ""; 31 | 32 | void SysInfo( void ); // update sysinfo String 33 | void ledTog( uint8_t ledCMD ); // toggle RGB 34 | void handleNotFound( void ); // Server page 404 > 200 35 | void SeeSPIFFS(void); 36 | 37 | 38 | // #include "testcode.h" // code for testing stuff 39 | uint16_t waitVal = 500; 40 | #include "testcode.h" // code for testing stuff 41 | 42 | 43 | ESP8266WebServer server(80); 44 | 45 | 46 | 47 | void handleRoot() { 48 | digitalWrite(Rled, 1); 49 | // server.send(200, "text/plain", "hello from esp8266!"); 50 | webString = "Hello World! Reset setup() time:" + String(ts0) + " Time to WiFi Start Millis:" + String(ts1 - ts0) + "\nCurrent millis=" + String(millis()) + sysString; 51 | server.send(200, "text/plain", webString); // send to someones browser when asked 52 | digitalWrite(Rled, 0); 53 | } 54 | 55 | void handleBig() { 56 | digitalWrite(Rled, 1); 57 | // server.send(200, "text/plain", "hello from esp8266!"); 58 | String bigString = "Hello World! Reset setup() time:" + String(ts0) + " Time to WiFi Start Millis:" + String(ts1 - ts0) + "\nCurrent millis=" + String(millis()) + sysString; 59 | 60 | bigString += "\n"; 61 | for ( int ii = 0; ii < 26; ii++ ) { 62 | for ( int jj = 0; jj < 100; jj++ ) { 63 | bigString += (char)( ii + 65); 64 | } 65 | bigString += "\n"; 66 | } 67 | server.send(200, "text/plain", bigString); // send to someones browser when asked 68 | bigString = ""; 69 | digitalWrite(Rled, 0); 70 | } 71 | 72 | 73 | void handleNotFound() { 74 | digitalWrite(Rled, 1); 75 | webString = "File Not Found\n\n"; 76 | webString += "URI: "; 77 | webString += server.uri(); 78 | webString += "\nMethod: "; 79 | webString += (server.method() == HTTP_GET) ? "GET" : "POST"; 80 | webString += "\nArguments: "; 81 | webString += server.args(); 82 | webString += "\n"; 83 | for (uint8_t i = 0; i < server.args(); i++) { 84 | webString += " " + server.argName(i) + ": " + server.arg(i) + "\n"; 85 | } 86 | // server.send(404, "text/plain", message); 87 | server.send(200, "text/plain", webString); 88 | digitalWrite(Rled, 0); 89 | } 90 | 91 | int16_t EStop = 0; 92 | // Put any risky Startup code - or one time run code here to prevent loss of OTA 93 | void setup2(void) { 94 | SeeSPIFFS(); 95 | } 96 | 97 | 98 | void setup(void) { 99 | ts0 = millis(); 100 | ledTog( 255 ); 101 | 102 | webString.reserve(360); // OVER ALLOCATE these strings to try to prevent heap fragmentation as they grow 103 | sysString.reserve(260); 104 | FirstHeap.reserve(40); 105 | // Serial.begin(74880); 106 | Serial.begin(115200); 107 | while (!Serial && (millis() <= 1000)); 108 | if ( digitalRead( ESTOP_PIN ) ) { 109 | EStop = 1; 110 | Serial.setDebugOutput(true); // OPTIONAL 111 | } 112 | if ( EStop ) { 113 | Serial.println(); 114 | Serial.print( ESTOP_PIN ); 115 | Serial.print("::ESTOP PIN HIGH :: OTA ONLY !!!!"); 116 | } 117 | 118 | WiFi.begin(ssid, password); 119 | Serial.println("\nWiFi begin:"); 120 | Serial.println(szBuild); 121 | // Wait for connection 122 | while (WiFi.status() != WL_CONNECTED) { 123 | delay(500); 124 | ledTog( 0 ); 125 | Serial.print("."); 126 | } 127 | ts1 = millis(); 128 | setupOTA(); // Call BasicOTA setup 129 | Serial.print("\nConnected to "); 130 | Serial.println(ssid); 131 | Serial.print("IP address: "); 132 | Serial.println(WiFi.localIP()); 133 | SysInfo(); 134 | if (MDNS.begin("esp8266")) { 135 | Serial.println("MDNS responder started"); 136 | } 137 | waitVal = 1 + (100 * ((millis() / 10000) % 10)); 138 | 139 | server.on("/", handleRoot); 140 | server.on("/t", []() { // if you add this subdirectory to your webserver call, you get text below :) 141 | webString = "Millis: " + String((int)millis()) + "\nToggle: " + String((int)ttog); 142 | server.send(200, "text/plain", webString); // send to someones browser when asked 143 | }); 144 | server.on("/big", handleBig); 145 | server.onNotFound(handleNotFound); 146 | server.begin(); 147 | Serial.println("HTTP server started"); 148 | Serial.print("Time since reset:" ); Serial.print( ts0); Serial.print( " Time to Start Millis: "); Serial.println( ts1 - ts0); 149 | lm2 = millis(); 150 | mmiss = 0; 151 | Serial.print("Sketch size: "); 152 | Serial.println(ESP.getSketchSize()); 153 | Serial.print("Free size: "); 154 | Serial.println(ESP.getFreeSketchSpace()); 155 | if ( !EStop ) { 156 | // Put any risky Startup code - or one time run code here to prevent loss of OTA 157 | setup2(); 158 | } 159 | else Serial.print("___ESTOP PIN HIGH :: OTA ONLY !!!!"); 160 | } 161 | 162 | 163 | void loop(void) { 164 | if ( !EStop ) { 165 | ledTog( 0 ); 166 | server.handleClient(); 167 | while (Serial.available()) { 168 | Serial.write(Serial.read()); 169 | } 170 | } 171 | ArduinoOTA.handle(); 172 | } 173 | 174 | 175 | -------------------------------------------------------------------------------- /Examples/ESP/HelloServerOTA/otahelp.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | // Serial & WiFi online on entry 4 | // Needed subset from BasicOTA example to have OTA runnin background 5 | // requires ArduinoOTA.handle(); in loop() 6 | void setupOTA() { 7 | Serial.println("Booting w/OTA"); 8 | /* Handle WiFI connect as needed in MAIN setup 9 | WiFi.mode(WIFI_STA); 10 | WiFi.begin(ssid, password); 11 | while (WiFi.waitForConnectResult() != WL_CONNECTED) { 12 | Serial.println("Connection Failed! Rebooting..."); 13 | delay(5000); 14 | ESP.restart(); 15 | } 16 | */ 17 | 18 | // Port defaults to 8266 19 | // ArduinoOTA.setPort(8266); 20 | // Hostname defaults to esp8266-[ChipID] 21 | // ArduinoOTA.setHostname("myesp8266"); 22 | // No authentication by default 23 | // ArduinoOTA.setPassword((const char *)"123"); 24 | 25 | ArduinoOTA.onStart([]() { Serial.println("Start"); }); 26 | ArduinoOTA.onEnd([]() { Serial.println("End"); }); 27 | ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { 28 | Serial.printf("Progress: %u%%\n\r", (progress / (total / 100))); 29 | }); 30 | ArduinoOTA.onError([](ota_error_t error) { 31 | Serial.printf("Error[%u]: ", error); 32 | if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed"); 33 | else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed"); 34 | else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed"); 35 | else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed"); 36 | else if (error == OTA_END_ERROR) Serial.println("End Failed"); 37 | }); 38 | ArduinoOTA.begin(); 39 | Serial.println("Ready"); 40 | Serial.print("IP address: "); 41 | Serial.println(WiFi.localIP()); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /Examples/ESP/HelloServerOTA/testcode.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | void SeeSPIFFS() { 5 | if ( SPIFFS.begin() ) { 6 | Serial.println("SPIFFS TRUE"); 7 | File file = SPIFFS.open("/here.txt", "r"); 8 | int ii = 0; 9 | char cbuffer[100] = ""; 10 | int jj; 11 | int kk; 12 | if (file) { 13 | Serial.println("file here.txt found!"); 14 | jj = file.size(); 15 | while ( ii < jj ) { 16 | if ( (jj - ii) > 99 ) kk = 99; else kk = jj - ii; 17 | file.readBytes(cbuffer, kk); 18 | cbuffer[kk] = 0; 19 | Serial.print(cbuffer); 20 | ii += kk; 21 | } 22 | file.close(); 23 | Serial.println("\n-------"); 24 | } 25 | 26 | file = SPIFFS.open( "/hex/BaseBlinkT31.hex", "r"); 27 | if (file) { 28 | ii = 0; 29 | Serial.println("file /hex/BaseBlinkT31.hex found!"); 30 | jj = 400; // file.size(); 31 | while ( ii < jj ) { 32 | if ( (jj - ii) > 99 ) kk = 99; else kk = jj - ii; 33 | file.readBytes(cbuffer, kk); 34 | cbuffer[kk] = 0; 35 | Serial.print(cbuffer); 36 | ii += kk; 37 | } 38 | file.close(); 39 | Serial.println("\n-------"); 40 | } 41 | 42 | Serial.println("DIR /"); 43 | Dir dir = SPIFFS.openDir("/"); 44 | while (dir.next()) { 45 | Serial.print(dir.fileName()); 46 | file = dir.openFile("r"); 47 | Serial.print(" Len="); 48 | Serial.println(file.size()); 49 | file.close(); // this not shown in sample ??? 50 | } 51 | Serial.println("DIR /hex"); 52 | dir = SPIFFS.openDir("/hex"); 53 | while (dir.next()) { 54 | Serial.print(dir.fileName()); 55 | file = dir.openFile("r"); 56 | Serial.print(" Len="); 57 | Serial.println(file.size()); 58 | file.close(); // this not shown in sample ??? 59 | } 60 | } 61 | else if ( SPIFFS.format() ) { 62 | Serial.print("SPIFFS FORMATTED"); 63 | } 64 | } 65 | 66 | 67 | int ttog = 0; 68 | uint32_t lm = 0; 69 | uint32_t lm2 = 0; 70 | uint32_t mmiss = 0; 71 | uint32_t amiss = 0; // amplitude of missed millis 72 | 73 | void ledTog( uint8_t ledCMD ) { 74 | int8_t ii; 75 | 76 | if ( 255 == ledCMD ) { 77 | for ( ii = 0; ii < RGB_LEDS; ii++ ) { 78 | digitalWrite(ledsRGB[ii], LOW); 79 | pinMode(ledsRGB[ii], OUTPUT); 80 | } 81 | digitalWrite(ledsRGB[RGB_LEDS - 1], HIGH); 82 | return; 83 | } 84 | 85 | if ( millis() > (lm2 + 1) ) { 86 | amiss += (millis() - (lm2 + 1)); 87 | mmiss += 1; 88 | } 89 | lm2 = millis(); 90 | if ( !(millis() % waitVal) && millis() != lm ) { 91 | lm = millis(); // On Teensy it would hit multiple times per ms 92 | waitVal = 1 + (100 * ((millis() / 10000) % 10)); 93 | if (ttog % 2) { 94 | digitalWrite(ledsRGB[0], LOW); 95 | digitalWrite(ledsRGB[1], HIGH); 96 | Serial.print("B."); 97 | } 98 | else { 99 | digitalWrite(ledsRGB[0], HIGH); 100 | digitalWrite(ledsRGB[1], LOW); 101 | digitalWrite(ledsRGB[2], LOW); 102 | Serial.print("G."); 103 | } 104 | ttog += 1; 105 | if ( ttog > 39 ) { 106 | digitalWrite(ledsRGB[0], LOW); 107 | digitalWrite(ledsRGB[1], LOW); 108 | digitalWrite(ledsRGB[2], HIGH); 109 | Serial.print("\nGreen ::Missed ms="); 110 | Serial.print( mmiss ); 111 | Serial.print(" ::ms missed="); 112 | Serial.print( amiss ); 113 | Serial.print(" ::Wait Val="); 114 | Serial.print( waitVal); 115 | G40cnt++; 116 | Serial.print(" :: Green NL CNT="); 117 | Serial.print( G40cnt); 118 | Serial.print(" Millis:"); 119 | Serial.println(millis()); 120 | if ( amiss - mmiss > 1000 ) { 121 | Serial.print("\n ----- ::LONG ms missed="); 122 | Serial.println( amiss - mmiss ); 123 | } 124 | mmiss = 0; 125 | amiss = 0; 126 | ttog = 0; 127 | if ( !(millis() % 4)) { 128 | SysInfo(); 129 | } 130 | } 131 | } 132 | } 133 | 134 | 135 | void SysInfo() { 136 | // Get some information abut the ESP8266 137 | uint32_t freeheap = ESP.getFreeHeap(); 138 | if ( 0 == FirstHeap.length() ) FirstHeap = "[ 1st FHSz= " + String(freeheap) + " @" + String(millis()) + "]"; 139 | sysString = "\nFree Heap Size= " + String(freeheap) + FirstHeap; 140 | uint32_t chipID = ESP.getChipId(); 141 | sysString += "\nESP8266 chip ID= " + String(chipID); 142 | uint32_t flashChipID = ESP.getFlashChipId(); 143 | sysString += "\n ID = " + String(flashChipID); 144 | uint32_t flashChipSize = ESP.getFlashChipSize(); 145 | sysString += "\n sz= " + String(flashChipSize); 146 | sysString += " bytes"; 147 | uint32_t flashChipSpeed = ESP.getFlashChipSpeed(); 148 | sysString += "\n speed = " + String(flashChipSpeed); 149 | sysString += " Hz"; 150 | uint32_t getVcc = ESP.getVcc(); 151 | sysString += "\n supply voltage = " + String(getVcc); 152 | sysString += "V"; 153 | sysString += "\nSketch sz:" + String(ESP.getSketchSize()); 154 | sysString += "\nFree sz:" + String(ESP.getFreeSketchSpace()); 155 | sysString += "\nIP#: " + String(WiFi.localIP()); 156 | sysString += "\nLast SysInfo Update @" + String(millis()) + "\n"; 157 | sysString += "\n BldID:" + String(szBuild); 158 | 159 | Serial.print(FirstHeap.length()); 160 | Serial.println( "str len First"); 161 | Serial.print(sysString.length()); 162 | Serial.println( "str len sys"); 163 | Serial.print(webString.length()); 164 | Serial.println( "str len web"); 165 | Serial.print("IP address: "); 166 | Serial.println(WiFi.localIP()); 167 | Serial.print(" BldID:"); 168 | Serial.println(szBuild); 169 | } 170 | 171 | 172 | -------------------------------------------------------------------------------- /Examples/ESP/HelloServerOTA/userssid.h: -------------------------------------------------------------------------------- 1 | const char* ssid = "SSID_HERE"; 2 | const char* password = "PASSWORD_HERE"; 3 | -------------------------------------------------------------------------------- /Examples/Teensy/S2FB_Proxy_jan31b.ino: -------------------------------------------------------------------------------- 1 | // PESKY NOT PRESENT 2 | //#define ESP8266_CH_PD 16 //EN 3 | //#define ESP8266_GPIO2 2 4 | //#define ESP8266_GPIO 1 5 | //#define ESP8266_RST 16 6 | 7 | // END ROW GPIO :: 4, 2, 15, 13, 12,(14) 8 | 9 | char szBuild[] = "T_3.2_1.0.5"; 10 | 11 | #define ESP8266_EN 16 12 | #define ESP8266_GPIO16 17 13 | #define ESP8266_ESTOP 17 14 | #define ESP8266_GPIO14 18 15 | // TODO : Need a RUNTIME HAL layer to Adjust these at runtime based on T_3.2 UNIT 16 | // Serial 2 :: This is normal config for New Serial2 onehorse or where Generic ESP8266 should connect 17 | #define ESP8266_PGM0 7 18 | #define ESP8266_ALIVE 8 19 | #define ESP8266_TX 9 20 | // Serial 3 SWAP to Alternate Serial2 :: SPECIAL CASE Unit Serial3 Mapped to ALT_Serial2 21 | // #define ESP8266_PGM0 9 22 | // #define ESP8266_ALIVE 10 23 | // #define ESP8266_TX 31 24 | #define ESP8266_GPIO3 10 25 | #define ESP8266_RX 26 26 | 27 | //Serial Ports 28 | #define ESP8266_SERIAL Serial2 29 | #define ESP8266_SERIAL_BAUD_INIT 115200 30 | 31 | // https://forum.pjrc.com/threads/32502-Serial2-Alternate-pins-26-and-31 32 | // do Serial2.begin(9600): then:: 33 | 34 | #define qBlink() (digitalWriteFast(LED_BUILTIN, !digitalReadFast(LED_BUILTIN) )) 35 | void doProgram (); // Put ESP into Program Mode 36 | void ShowESTOP(void ) ; 37 | 38 | void setup() { 39 | pinMode(ESP8266_ESTOP, OUTPUT); 40 | digitalWrite(ESP8266_ESTOP, LOW); 41 | ShowESTOP(); 42 | pinMode(ESP8266_ALIVE, INPUT); // TODO - not implemented 43 | pinMode(LED_BUILTIN, OUTPUT); 44 | digitalWrite(LED_BUILTIN, HIGH); 45 | Serial.begin(9600); 46 | ESP8266_SERIAL.begin(ESP8266_SERIAL_BAUD_INIT); 47 | while (!Serial && (millis () <= 3000)) 48 | ; 49 | Serial.println("Hello ESP!"); 50 | Serial.println(szBuild); 51 | 52 | qBlink(); 53 | 54 | if ( 9 == ESP8266_PGM0 ) { // Set Serial 2 Alternate when PGM pin on Serial2::Tx pin 9 55 | CORE_PIN9_CONFIG = 0; 56 | CORE_PIN10_CONFIG = 0; 57 | CORE_PIN26_CONFIG = PORT_PCR_PE | PORT_PCR_PS | PORT_PCR_PFE | PORT_PCR_MUX(3); 58 | CORE_PIN31_CONFIG = PORT_PCR_DSE | PORT_PCR_SRE | PORT_PCR_MUX(3); 59 | Serial.println("ALTERNATE Serial2 @ 26/31"); 60 | } 61 | else 62 | Serial.println("Serial2 onehorse & ESP-12E"); 63 | } 64 | 65 | void doProgram ( uint16_t CMD ) 66 | { 67 | if ( ESP8266_PGM0 == CMD ) { 68 | pinMode(ESP8266_PGM0, OUTPUT); 69 | digitalWrite(ESP8266_PGM0, HIGH); 70 | } 71 | pinMode(ESP8266_EN, OUTPUT); // DOING THIS KILLS SERIAL2_Alternate ????? 72 | digitalWrite(ESP8266_EN, HIGH); 73 | if ( ESP8266_PGM0 == CMD ) { 74 | digitalWrite(ESP8266_PGM0, LOW); 75 | } 76 | digitalWrite(ESP8266_EN, LOW); //Reset: 77 | delay(2); 78 | pinMode(ESP8266_EN, INPUT); 79 | if ( ESP8266_PGM0 == CMD ) { 80 | delay(400); 81 | digitalWrite(ESP8266_PGM0, HIGH); 82 | } 83 | } 84 | 85 | 86 | void loop() { 87 | } 88 | 89 | void serialEvent2() { 90 | qBlink(); 91 | while (ESP8266_SERIAL.available()) { 92 | Serial.write( ESP8266_SERIAL.read() ); 93 | } 94 | } 95 | 96 | 97 | byte incomingByte; 98 | bool pgmMode = false; 99 | void serialEvent() { 100 | byte cmdDone = 0; 101 | int ii = 0; 102 | qBlink(); 103 | if ( false == pgmMode ) { // MUST NOT PARSE INPUT DURING PROGRAM MODE !!!!!!! 104 | while (Serial.available()) { 105 | incomingByte = Serial.read(); 106 | if ( !ii ) 107 | Serial.println("<<<"); 108 | Serial.print(" RCV:"); 109 | ii++; 110 | Serial.print(incomingByte, DEC); 111 | if ( '`' == incomingByte ) { 112 | cmdDone = 1; // PREFIX first CMD with '`' 113 | } 114 | else if ( cmdDone ) { 115 | if ( 'P' == incomingByte ) { 116 | cmdDone = 'P'; 117 | Serial.println("Going to PGM MODE."); 118 | pgmMode = true; 119 | doProgram(ESP8266_PGM0); 120 | Serial.println("no more commands accepted:: RESTART TEENSY AFTER PROGRAM UPLOADED !!!!!"); 121 | Serial.println("!!!!! >>>> DISABLE SERIAL MONITOR <<<<<<<<< !!!!!"); 122 | } 123 | if ( 'R' == incomingByte ) { 124 | cmdDone = 'R'; 125 | Serial.println("Doing ESP8266 RESET."); 126 | pgmMode = false; 127 | doProgram(ESP8266_EN); 128 | } 129 | if ( 'E' == incomingByte ) { 130 | ShowESTOP(); 131 | Serial.println("Going to ESTOP."); 132 | digitalWrite(ESP8266_ESTOP, HIGH); 133 | cmdDone = 'E'; 134 | } 135 | if ( 'e' == incomingByte ) { 136 | ShowESTOP(); 137 | Serial.println("Leaving ESTOP."); 138 | digitalWrite(ESP8266_ESTOP, LOW); 139 | cmdDone = 'e'; 140 | } 141 | if ( cmdDone ) { 142 | delay( 100 ); 143 | qBlink(); 144 | } 145 | } 146 | ESP8266_SERIAL.write(incomingByte); 147 | } 148 | if ( ii ) Serial.println(">>>"); 149 | } 150 | else { 151 | while (Serial.available()) { 152 | ESP8266_SERIAL.write(Serial.read()); 153 | qBlink(); 154 | } 155 | } 156 | } 157 | 158 | 159 | void ShowESTOP() { 160 | if ( digitalRead( ESP8266_ESTOP ) ) 161 | Serial.println("WAS ESTOP."); 162 | else 163 | Serial.println("was NOT ESTOP."); 164 | } 165 | 166 | -------------------------------------------------------------------------------- /HTML/FirstPage/banner.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | 20 | 21 | 22 |

ESP8266 Server Page

23 | 24 | -------------------------------------------------------------------------------- /HTML/FirstPage/cssfile.css: -------------------------------------------------------------------------------- 1 | BODY{background: "#FF9966"} -------------------------------------------------------------------------------- /HTML/FirstPage/index.htm: -------------------------------------------------------------------------------- 1 |  2 | 3 | Frame with CSS 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /HTML/FirstPage/main.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 17 | 18 | 19 |

Monitor your ESP8266 Server

20 | 21 |

Enter the IP of the server in the text box.
22 | 23 | include '/subpage' as desired
24 | Press 'Load IP' to display the page
25 | Press 'AUTO' to display the page on an auto update basis [Refresh page to stop AUTO]
26 | 27 | 28 | -------------------------------------------------------------------------------- /HTML/FirstPage/menu.htm: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 16 | 17 | 18 | 19 | 20 | ESP IP: 21 | 22 | 23 | 24 | 25 | 26 | 27 |

28 | 29 | 112 | 113 | -------------------------------------------------------------------------------- /HTML/FirstPage/style.css: -------------------------------------------------------------------------------- 1 | body {background: "#ffffff"} 2 | a {text-decoration:none} -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | FOUND THIS SERVER: https://github.com/nailbuster/myWebServer that seems to incorporate all I found and more in a clean library. 2 | >> to enable OTA upload in myWebServer uncomment this line :: 3 | //#define ALLOW_IDEOTA //define this to allow IDE OTA, good while debugging.... 4 | here :: https://github.com/nailbuster/myWebServer/blob/master/myWebServer.h#L48 5 | 6 | The above server proving nice and useful - Participating in new work with Teensy here :: https://github.com/FrankBoesing/FlexiBoard 7 | Working with IDE 1.6.12 and ESP_Arduino Rev 2.3. 8 | Current Update here: https://github.com/FrankBoesing/FlexiBoard/blob/master/extras/ESP8266/README2.ArduinoESP.md 9 | 10 | Using Arduino on Teensy and ESP8266 11 | 12 | Work in Progress: GOING WELL - multiple ESP units tested with OTA and now Serial program over Teensy USB to Serial 13 | 14 | https://github.com/esp8266/arduino 15 | 16 | https://github.com/esp8266/Arduino/blob/master/doc/ota_updates/ota_updates.md#arduinoota 17 | * NOTE: Arduino IDE 1.6.7 is the first release that provides support for ArduinoOTA library 18 | 19 | This link to working with SPIFFS file system on ESP: http://esp8266.github.io/Arduino/versions/2.1.0-rc1/doc/filesystem.html 20 | [ newer 0.2.0 working for OTA SPIFFS upload: https://github.com/esp8266/arduino-esp8266fs-plugin/releases ] 21 | 22 | Connected and powered by a PJRC Teensy 3.2. 23 | 24 | ESP units are a 12E and a onehorse unit from Tindie : https://www.tindie.com/products/onehorse/esp8266-add-on-for-teensy-32/ 25 | > A second onehorse unit with PCB to Serial2 used in latest update, can wire to ESP_generic the same way. Initial code (commented out) used a Serial3 PCB unit with wires from Rx/Tx to Teensy ALTERNATE Serial2 pins on a FrankB connectorboard. 26 | 27 | Added: Example for Teensy 3.2 (will work on 3.1 with external ESP power) Proxy sketch that routes Serila# to Serial/USB for debug or programming. USB commands can be issues to: PROGRAM [P :: reset to pgm mode serial], RESET[R}, ESTOP [E=ON, e=off] [Command LETTERS preceded by ` (left apostrophe character). All other USB imput echoed to ESP. 28 | 29 | Code functions well - is a mess to read - and poorly commented, some notes here on functionality. 30 | 31 | First "HelloServerOTA" example for ESP8266 32 | --- Started with HelloServer ESP example then merged added OTA code from BasicOTA example 33 | * Edit the userssid.h file in the sketch folder to supply your network SSID and password 34 | * The sketch cycles power to GPIO 12,13,15 where I stuck an RGB LED, it puts out serial data, presents web text. 35 | * Incorporates Arduino OTA Port based uploading 36 | * Use build for your ESP unit, I set mine to 1M ( 256K SPIFFS ) to allow OTA code to fit at 259K it is 33% code space 37 | * [pending] Bad code crashing into wdt (watchdog timer)? - added setup() pin read to skip user code except OTA after WiFii 38 | * Added Serial receive echo back our Seial, it seems SerialEvent not supported so added to loop() 39 | * Any NEW code or code that can CRASH needs to be under 'if (!ESTOP)' - you can then set the declared pin high on Teensy (`E) and reset (`R) to preserve the OTA code ability to recover from crashing resets - I did thie ONCE with a SPIFFS edit, and implemented this failsafe. 40 | * OTA uploads are 3-6 times faster than Serial uploads, and actually seem more reliable 41 | * Check your SPIFFS and other settings in tools as the IDE can reset them - in one case that trashed my OTA code as it shrunk the program area. 42 | 43 | First AutoRefresh "FirstPage" Client side Web Page set: start index.htm 44 | ---Sample auto update browser script to monitor ESP8266 45 | * Edit menu.htm for starting IP if you have a fixed one to save editing it (include subpage if you make one like /t ) 46 | * >> edit :: ESP IP: 47 | * Press LOAD to show the web page in lower frame 48 | * Press AUTO button for 2500ms auto refresh, edit menu.htm to adjust timing 500ms works, when no multi unit collisions 49 | * >> setInterval(loadeip, 2500) 50 | 51 | 52 | Sample web output: 53 | Hello World! Reset setup() time:3497 Time to WiFi Start Millis:4514 54 | *Current millis=1601225 55 | *Free Heap Size= 37824[ 1st FHSz= 38144 @8013] 56 | *ESP8266 chip ID= 850894 57 | * ID = 1327343 58 | * sz= 1048576 bytes 59 | * speed = 40000000 Hz 60 | * supply voltage = 3410V 61 | *Sketch sz:262912 62 | *Free sz:499712 63 | *IP#: 1677830336 64 | *Last SysInfo Update @1533898 65 | * 66 | * BldID:OTA_1.0.1 67 | --------------------------------------------------------------------------------