mateuszlesko / NodeMCU_LED_Control

the simple project to figuring out how to control end device via http with ESP8266

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node MCU LED Control:

About project

Thanks to this project I have learned how to control actuating device (LED diodes) via sending requests http.

To represent LED lights I used power of 2:

GREEN = 2^0 = 1

YELLOW = 2^1 = 2

RED = 2^2 = 4

Project contains:

  • http server written in GO,
  • client code for ESP8266 in INO = listening one endpoint, and depending on its value control LEDs

Project features:

  • control LED lights via HTTP
  • logging of LED changes

HARDRWARE PART:

Traffic lights LED module:

traffic light module

ESP 8266 : Pinouts

ESP 8266 pinouts

ESP8266 PINOUT LED MODULE
GND GND
D1 R
D2 Y
D4 G

SERVER ENPOINTS:

Set LED's status:

`http://IP:5108/led/setstatus?led=value`

Where:

  • IP = your computer's IP address, where api is running
  • Value = Integer value from 0 to 7
LED Statues:

states table

Check LED's status:

http://IP:5108/led/checkstatus

Return: integer value which representing LEDs turn on status (see table above)

RUN PROJECT INSTRUCTION:

  1. RUN server:
    1. go to web folder
    2. use command go run .
  2. ESP8266:
    1. use Arduino IDE to edit code: edit SSID and password
    2. connect LED module to ESP8266 in the right way
    3. upload code to your ESP via Arduino IDE
  3. TEST:
    1. Send request via Postman to endpoint: /led/setstatus?led=
    2. Observe change on LED lights

About

the simple project to figuring out how to control end device via http with ESP8266


Languages

Language:C++ 59.7%Language:Go 40.3%