Skip to content

dirk-pieterse/cloud4rpi-esp8266-micropython

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloud4RPi Library and Examples for ESP8266 with MicroPython

Build Status

Running the Sample Code

  1. Connect your MicroPython-enabled ESP8266 to a Wi-Fi network and configure it for the WebREPL. You can do it by accesing the console via the serial port and executing the following commands:

    >>> from network import WLAN
    >>> STA = WLAN(0); STA.active(1)
    >>> STA.connect('__SSID__', '__PASSWORD__')
    >>> STA.ifconfig()  # Outputs the network configuration. If it isn't valid, wait and re-execute
  2. Download the MQTT library and put it to your ESP8266 with the name mqtt.py using the WebREPL.

  3. Clone this repository or download cloud4rpi.py and main.py files.

  4. Log into your Cloud4RPi account or create a new one.

  5. Copy your device's Device Token.

  6. Edit the main.py file. Put your Wi-Fi network data and the Device Token to the required variables.

  7. Connect the LED to GPIO12 and a button to GPIO16. If you need to use another pins, change the required variables in main.py.

  8. Transfer the cloud4rpi.py file and edited main.py file to your ESP8266.

  9. Reset the ESP8266 physically of using the console:

    >>> import machine
    >>> machine.reset()
  10. Notice that the device went online and started sending data.

  11. Go to the Control Panels page and add a new control panel.

  12. Add two Switch widgets and bind them to the LED variable.

  13. Add a new Text widget and bind it to the Button variable. Configure different colors for "true" and "false" strings.

You can use this control panel to see when the button was pressed and control the LED.

See Also

About

Cloud4RPi Library and Examples for ESP8266 with MicroPython

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.8%
  • Makefile 3.2%