A program allows to set HIGH/LOW for D pins in ESP8266 NodeMCU board, from D0 to D9 (hence count to 9).
Using this we can make a switch through WiFi to turn on/off 9 diffirent devices (actually 7 because D0 and D4 are for 2 built-in LEDs).
You need CP210x driver to connect the board to your computer.
We use PlatformIO for library management & building.
# Install Platformio
pip install platformio
# Set enviroments
export PLATFORMIO_BUILD_FLAGS='-DMQTTSERVER=\"test.mosquitto.org\"'
# Build project
pio run
# Upload firmware
pio run --target upload
You need a MQTT server, and an app to pub/sub messages to it.