Zoran Roncevic
Published © GPL3+

Testing Zerynth on NodeMCU

First Zerynth project on NodeMCU.

EasyShowcase (no instructions)30 minutes499
Testing Zerynth on NodeMCU

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1

Software apps and online services

Zerynth Studio
Zerynth Studio

Story

Read more

Code

Test.py

Python
import streams

# import the wifi interface
from wireless import wifi

# import wifi support !!! IMPORT ESP WIFI DRIVER
from espressif.esp8266wifi import esp8266wifi as wifi_driver

pinMode(D0,OUTPUT)
streams.serial()

sleep(5000)
state = HIGH

# init the wifi driver!
# The driver automatically registers itself to the wifi interface
# with the correct configuration for the selected device

wifi_driver.auto_init()


# use the wifi interface to link to the Access Point
# change network name, security and password as needed
print("Establishing Link...")
try:
    # FOR THIS EXAMPLE TO WORK, "Network-Name" AND "Wifi-Password" MUST BE SET
    # TO MATCH YOUR ACTUAL NETWORK CONFIGURATION
    wifi.link("Network-Name",wifi.WIFI_WPA2,"Wifi-Password")
    while True:
        if state == HIGH:
            state = LOW
        else:
            state = HIGH
        print("Link Active")
        digitalWrite(D0,state)
        sleep(3000)
except Exception as e:
    print("ooops, something wrong while linking :(", e)
    while True:
        sleep(1000)

Credits

Zoran Roncevic

Zoran Roncevic

18 projects • 109 followers
Hackster Live ambassador in Serbia. Organizer of Maker NS community.
Contact

Comments