Since the XK12 IoT Starter Kit is Python programmable in Zerynth Studio, it's pretty easy to use and simple.
In this tutorial, you can see how to get started with the kit and how to do some LED blinking.
For this tutorial, the CW02 development board was used (included in the kit). It’s based on the ESP-WROOM-32 by Espressif Systems and it's powered by Zerynth, which means that the board already has a Zerynth license inside. All you need to do to activate it is enter a Voucher Code at the registration phase.
Getting StartedTo get started you'll need to:
- Assemble the CW02 xChip with the IP01 module (USB Programming Interface).
- Connect on a USB port of your laptop, where you've installed Zerynth Studio.
- Select the XinaBox CW02 on the Device Management Toolbar.
- Register the device by clicking the “Z” button from the Zerynth Studio. In this phase, you should redeem your coupon, as mentioned before.
- Create a Zerynth Virtual Machine for the device by clicking the “Z” button for the second time
- Virtualize the device by clicking the “Z” button for the third time.
After the virtualization, the XinaBox CW02 is ready to be programmed in Python and the Zerynth scripts uploaded.
Just search and clone the example “Blink”.
After that, we need to edit the code in order to set up pin attached to the LED. As you can see opening the pinout of the board, XinaBox CW02 has 3 LEDs, Red, Green and Blue, attached respectively at pin D25, D26 and D27.
Since we want to blink the green LED, edit the code as follows.
Now you can uplink the script into the board and you'll see your LED blinking. That's it, enjoy!
And here is the code:
# D0 to D127 represent the names of digital pins
# On most Arduino-like boards Pin D13 has an on-board LED connected.
# However Zerynth abstracts the board layout allowing to use LED0, LED1, etc as led names.
# In this example LED0 is used.
pinMode(D26,OUTPUT) # green LED
# loop forever
while True:
digitalWrite(D26, HIGH) # turn the LED ON by setting the voltage HIGH sleep(1000) # wait for a second
digitalWrite(D26, LOW) # turn the LED OFF by setting the voltage LOW sleep(1000) # wait for a second
Comments