703
edits
m (→UDP sending) |
|||
(8 intermediate revisions by the same user not shown) | |||
Line 119: | Line 119: | ||
== Use as a standalone Microcontroller Board == | == Use as a standalone Microcontroller Board == | ||
[[File:ESP8266_Standalone.png| | Installation Instructions for the Arduino IDE: https://github.com/esp8266/Arduino | ||
[[File:ESP8266_Standalone.png | 800px]] | |||
Enter Flash mode (to upload new firmware): | Enter Flash mode (to upload new firmware): | ||
Line 131: | Line 133: | ||
* GPIO0 (IO0) to GND | * GPIO0 (IO0) to GND | ||
*/ | */ | ||
void setup() { | void setup() { | ||
Line 146: | Line 146: | ||
} | } | ||
</source> | |||
'''pin mapping:''' | |||
<source lang = c> | |||
ESP8266 PINS | |||
============ | |||
Arduino Pin 0 = IO0 | |||
Arduino Pin 1 = Blue LED | |||
Arduino Pin 2 = IO2 | |||
Arduino Pin 3 = ?? | |||
Arduino Pin 4 = IO4 | |||
Arduino Pin 5 = IO5 | |||
Arduino Pin 6 = ?? | |||
Arduino Pin 7 = ?? | |||
Arduino Pin 8 = ?? | |||
Arduino Pin 12 = IO12 | |||
Arduino Pin 13 = IO13 | |||
Arduino Pin 14 = IO14 | |||
Arduino Pin 15 = IO15 | |||
</source> | |||
== UDP sending == | |||
<source lang=c> | |||
#include <ESP8266WiFi.h> | |||
#include <ESP8266mDNS.h> | |||
#include <WiFiUdp.h> | |||
WiFiUDP udp; | |||
const char* ssid = "yourWifiName"; | |||
const char* password = "yourPassword"; | |||
const char* hostString = "yourHostName"; | |||
void setup() { | |||
Serial.begin(57600); | |||
delay(100); | |||
Serial.println("\r\nsetup()"); | |||
WiFi.hostname(hostString); | |||
WiFi.begin(ssid, password); | |||
while (WiFi.status() != WL_CONNECTED) { | |||
delay(250); | |||
Serial.print("."); | |||
} | |||
Serial.println(""); | |||
Serial.print("Connected to "); | |||
Serial.println(ssid); | |||
Serial.print("IP address: "); | |||
Serial.println(WiFi.localIP()); | |||
if (!MDNS.begin(hostString)) { | |||
Serial.println("Error setting up MDNS responder!"); | |||
} | |||
Serial.println("mDNS responder started"); | |||
} | |||
void loop() { | |||
IPAddress broadcastIp(192, 168, 0, 110); | |||
//IPAddress broadcastIp(255, 255, 255, 255); | |||
udp.beginPacket(broadcastIp,5555); | |||
udp.write("hi"); | |||
udp.endPacket(); | |||
delay(500); | |||
} | |||
</source> | </source> | ||
== Reverting Firmware to AT Firmware == | == Reverting Firmware to AT Firmware == | ||
This is for the esp-201 module, coming with 4mbit (512kB) flash. | |||
Get the latest Firmware on the espressif bbs home page: | |||
http://bbs.espressif.com/viewtopic.php?f=46&t=2054 | http://bbs.espressif.com/viewtopic.php?f=46&t=2054 | ||
(this was last checked 2016-05-10) | (this was last checked 2016-05-10 - there might be a more up to date version now) | ||
either use the flash download tool from the above linked page or for example the very useful esptool: | either use the flash download tool from the above linked page or for example the very useful esptool: | ||
https://github.com/themadinventor/esptool | https://github.com/themadinventor/esptool | ||
extract the downloaded files, open a shell and change into the directory "/ESP8266_NONOS_SDK/bin" | |||
<source lang=bash> | |||
esptool.py --port /dev/ttyUSB0 write_flash 0x00000 boot_v1.2.bin 0x01000 at/512+512/user1.1024.new.2.bin 0x3e000 blank.bin 0x7e000 blank.bin | |||
</source> | |||
or for an original ai thinker firmware: | |||
download [http://bbs.espressif.com/download/file.php?id=189 esp_iot_sdk_v0.9.5_15_01_23.zip] | |||
<source lang=bash> | |||
esptool.py --port /dev/ttyUSB1 write_flash 0x00000 boot_v1.2.bin 0x01000 at/user1.512.new.bin 0x3e000 blank.bin 0x7e000 blank.bin | |||
</source> |
edits