Το ESP8266 είναι ένα εξαιρετικά δημοφιλές "πακέτο" WiFi και είναι εκατοντάδες οι χρήσεις του σε εφαρμογές αυτοματισμού. Για τον προγραμματισμό του χρειάζεται κάποιο interface και υπάρχουν πολλά που κυκλοφορούν στην αγορά. Μία από τις ποιο φτηνές επιλογές είναι η χρήση του αντάπτορα που παρουσιάζεται παρακάτω και βασίζεται στο chip CH340G. Μπορεί κανείς να το προμηθευτεί εύκολα από το ebay και απαιτεί drivers για να λειτουργήσει.
CH340G USB to Serial module
Μετά την εγκατάσταση του driver, το επόμενο βήμα είναι να ενημερώσουμε το περιβάλλον IDE του arduino ως εξης:
Installing the ESP8266 Board
To install the ESP8266 board in your Arduino IDE, follow these next instructions:
1) Open the preferences window from the Arduino IDE. Go to File > Preferences
2) Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into the “Additional Board Manager URLs” field as shown in the figure below. Then, click the “OK” button.
3) Open boards manager. Go to Tools > Board > Boards Manager
4) Scroll down, select the ESP8266 board menu and install “esp8266”
5) Choose your ESP8266 board from Tools > Board > Generic ESP8266 Module
Το επόμενο βήμα, είναι να προσθέσουμε ένα jumper μεταξύ των pin IO0 και GND. Αυτό διότι, κατά τη διάρκεια μεταφόρτωσης του προγράμματός μας στο ESP, το pin IO0 πρέπει να βρίσκεται σε λογικό 0 ή αλλιώς, να είναι στην γείωση.
Complete project details at http://randomnerdtutorials.com
int pin = 2;
void setup() { // initialize GPIO 2 as an output.
pinMode(pin, OUTPUT);
} // the loop function runs over and over again forever
void loop() {
digitalWrite(pin, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(pin, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}