703
edits
m (→UDP sending) |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 119: | Line 119: | ||
== Use as a standalone Microcontroller Board == | == Use as a standalone Microcontroller Board == | ||
Installation Instructions: https://github.com/esp8266/Arduino | Installation Instructions for the Arduino IDE: https://github.com/esp8266/Arduino | ||
[[File:ESP8266_Standalone.png | 800px]] | [[File:ESP8266_Standalone.png | 800px]] | ||
Line 133: | Line 133: | ||
* GPIO0 (IO0) to GND | * GPIO0 (IO0) to GND | ||
*/ | */ | ||
void setup() { | void setup() { | ||
Line 148: | 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 | This is for the esp-201 module, coming with 4mbit (512kB) flash. | ||
Get the latest Firmware on the espressif bbs home page: | Get the latest Firmware on the espressif bbs home page: |
edits