NodeMcu Wemos ESP8266-12E Uno Udviklingsboard, er designet som en “Arduino Uno R3”, men i stedet er der placeret en ESP-12E chip som gør det muligt at tilslutte Wifi.
Tekniske detaljer:
Microcontroller: ESP8266 ESP-12E
USB Chip: CH340G
Operating Voltage: 3.3V (Ikke 5V)
Digital I/O Pins: 11
Analog Input Pins: 1
Clock Speed: 80MHz/160MHz
Flash: 4M bytes
Length: 68.6mm
Width: 53.4mm
Weight: 25g
Vigtig: Dette board køre med 3.3v på ind/udgange. En normal arduino køre med 5v.
Programmering
Før du kan starte din programmering skal Arduino’s IDE software hentes. Dette program bruges til at programmere chippen.
Download fra dette link: Downlaod
Inden programmeringen kan udfæres skal den rigtige “COM” port findes. Klik “Værktøj/Port” – og vælg COM port.
Vigtigt: (Kan kun uploade kode med 115200 i Upload Speed)
Installere Driver (CH340g)
På nogle computer skal der ikke bruges en driver da windows selv finder ud af det. men med en CH340g USB chip skal computer i nogle tilfælde have en driver den kan downloades her.
Download: CH340g Driver (Windows 32 bit)
Download: CH340g Driver (Windows 64 bit)
Download: CH340g Driver (Prøv denne driver hvis de andre ikke virker)
Efter du har downloaded .Zip filen, åbner du mappen og klikker på “CH341SER”, Åben “SETUP” og installere.
Har du problemer med at få installeret driveren kan du hente hjælp HER.
Funktioner:
Pin | Function | ESP-8266 Pin |
TX | TXD | TXD |
RX | RXD | RXD |
A0 | Analog input, max 3.3V input | A0 |
D0 | IO | GPIO16 |
D1 | IO, SCL | GPIO5 |
D2 | IO, SDA | GPIO4 |
D3 | IO, 10k Pull-up | GPIO0 |
D4 | IO, 10k Pull-up, BUILTIN_LED | GPIO2 |
D5 | IO, SCK | GPIO14 |
D6 | IO, MISO | GPIO12 |
D7 | IO, MOSI | GPIO13 |
D8 | IO, 10k Pull-down, SS | GPIO15 |
G | Ground | GND |
5V | 5V | – |
3V3 | 3.3V | 3.3V |
RST | Reset | RST |
Installere ESP package (Arduino IDE)
- Åben Arduino IDE (Download her)
- Klik “Fil/Egenskaber”
- Indtast dette link i feltet “Additionel Board Manager URL’s”
- Link “http://arduino.esp8266.com/stable/package_esp8266com_index.json“
- Klik OK
- Åben “Værktøj/Board/Boards manager” (Lad programmet opdatere)
- Find “ESP8266” og installere
- Klik derefter “Værktøj/Board” og find (WeMos D1 R1)
- Du er nu klar til at sende en kode
Eksempel
Her viser vi et hurtig eksempel på hvordan du får modules “BUILTIN_LED” til at blinke via webbrowseren.
#include <ESP8266WiFi.h> #include <WiFiClient.h> //ESP Web Server Library to host a web page #include <ESP8266WebServer.h> //--------------------------------------------------------------- //Our HTML webpage contents in program memory const char MAIN_page[] PROGMEM = R"=====( <!DOCTYPE html> <html> <body> <center> <h1>WiFi LED on off demo: 1</h1><br> Ciclk to turn <a href="ledOn">LED ON</a><br> Ciclk to turn <a href="ledOff">LED OFF</a><br> <hr> <a href="https://circuits4you.com">circuits4you.com</a> </center> </body> </html> )====="; //--------------------------------------------------------------- //On board LED Connected to GPIO2 #define LED 2 //SSID and Password of your WiFi router const char* ssid = "Network"; const char* password = "Password"; //Declare a global object variable from the ESP8266WebServer class. ESP8266WebServer server(80); //Server on port 80 //=============================================================== // This routine is executed when you open its IP in browser //=============================================================== void handleRoot() { Serial.println("You called root page"); String s = MAIN_page; //Read HTML contents server.send(200, "text/html", s); //Send web page } void handleLEDon() { Serial.println("LED on page"); digitalWrite(LED_BUILTIN, LOW); //LED is connected in reverse server.send(200, "text/html", "LED is ON"); //Send ADC value only to client ajax request } void handleLEDoff() { Serial.println("LED off page"); digitalWrite(LED_BUILTIN, HIGH); //LED off server.send(200, "text/html", "LED is OFF"); //Send ADC value only to client ajax request } //============================================================== // SETUP //============================================================== void setup(void){ Serial.begin(115200); WiFi.begin(ssid, password); //Connect to your WiFi router Serial.println(""); //Onboard LED port Direction output pinMode(LED_BUILTIN, OUTPUT); //Power on LED state off digitalWrite(LED_BUILTIN,HIGH); // Wait for connection while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } //If connection successful show IP address in serial monitor Serial.println(""); Serial.print("Connected to "); Serial.println(ssid); Serial.print("IP address: "); Serial.println(WiFi.localIP()); //IP address assigned to your ESP server.on("/", handleRoot); //Which routine to handle at root location. This is display page server.on("/ledOn", handleLEDon); //as Per <a href="ledOn">, Subroutine to be called server.on("/ledOff", handleLEDoff); server.begin(); //Start server Serial.println("HTTP server started"); } //============================================================== // LOOP //============================================================== void loop(void){ server.handleClient(); //Handle client requests }
Kontakt os
Du er altid velkommen til at kontakte os på info@ardustore.dk, eller sende os en besked via messenger (Klik her) og vi vil hjælpe dig.
Anmeldelser
Der er endnu ikke nogle anmeldelser.