PictoBlox also provides the ability to program Quarky using Python in Desktop / Laptop versions. Let’s see how you can do it in this lesson.
PictoBlox
With PictoBlox, you can program the Quarky!
If you haven’t installed PictoBlox, please follow the instructions:
STEP 1: Download the Pictoblox Installer (.exe) for Windows 7 and above (Release Notes).
STEP 2: Run the .exe file.
Some of the device gives the warning popup. You don’t have to worry, this software is harmless. Click on More info and then click on Run anyway.
STEP 3: Rest of the installation is straight forward, you can follow the popup and check on the option appropriate for your need.
Your software is now installed!
STEP 1: Download the Pictoblox Installer (.dmg).
STEP 2: Run the .dmg file.
STEP 1: Open Google Play Store on your Smartphone and and search for PictoBlox or visit the link here to head over to the Google Play Store. You can even scan the QR Code below from your Smartphone to head to the PictoBlox App.
STEP 2: Install the PictoBlox App.
Connecting Quarky with PictoBlox
Let’s begin by first connecting Quarky to PictoBlox. Follow the steps below for connecting Quarky to PictoBlox:
-
- First, connect Quarky to your laptop using a USB cable.
- Next, open PictoBlox on your desktop.
- After that, select Python Coding as your coding environment.
- Then, click the Board button in the toolbar and select Board as Quarky.
- Next, select the appropriate Serial port if the Quarky is connected via USB or the Bluetooth Port if you want to connect Quarky via Bluetooth and press Connect.
- Click on the Upload Firmware button. This will upload the latest firmware in Quarky.
Note: If your device already has the latest firmware, then PictoBlox will show the message – Firmware is already updated. For learning more you can refer to this tutorial: https://ai.thestempedia.com/docs/quarky/quarky-toubleshooting/updating-quarky-firmaware-with-pictoblox/
- Once the firmware is uploaded, Quarky starts the Getting Started program. This runs only for the first time. Run through it.
And voila! Quarky is now connected to PictoBlox.
Quarky Python Library for Stage Mode
Stage mode is one of the two modes you can write your programs in PictoBlox. In this mode, you can write scripts for the sprite and boards to interact with sprites in real-time. If you disconnect the board with PictoBlox, you cannot interact with the board anymore.
You can toggle between the upload mode and stage mode using the button on the top right side of PictoBlox.
In Python, use the following object declaration to use Python functions in Stage Mode:
quarky = Quarky()
Example – Beating Heart
The following code creates custom patterns on Quarky RGB LED in Stage Mode.
sprite = Sprite('Tobi')
quarky = Quarky()
import time
while True:
quarky.drawpattern("jjbjbjjjbbbbbjjbbbbbjjjbbbjjjjjbjjj")
time.sleep(0.4)
quarky.drawpattern("jjjjjjjjjbjbjjjjbbbjjjjjbjjjjjjjjjj")
time.sleep(0.4)
Quarky Python Library for Upload Mode
Upload mode allows you to write scripts and upload them to the board so that you can use them even when it is not connected to your computer, for example, you need to upload a script for making moving robots. In this case, Quarky will run offline according to the program and it cannot interact with the stage.
In Python, use the following object declaration to use Python functions in Upload Mode:
from quarky import *
Example – Beating Heart
Follow the steps:
- Open a new project in PictoBlox.
- Select the Python Coding mode. Switch to Upload Mode.
- Connect Quarky to PictoBlox.
- Create the following code in Python editor:
from quarky import * import time while True: quarky.drawpattern("jjbjbjjjbbbbbjjbbbbbjjjbbbjjjjjbjjj") time.sleep(1) quarky.drawpattern("jjjjjjjjjbjbjjjjbbbjjjjjbjjjjjjjjjj") time.sleep(1)
- Click on the Upload button.
- Observe the Quarky.
Conclusion
In this lesson, we learned how to program Quarky using Python in both Stage Mode and Upload Mode with PictoBlox. We also saw how to connect Quarky to PictoBlox, and the different libraries available in PictoBlox for Python. We also wrote a program to create custom patterns on the Quarky RGB LED. We hope you have fun programming Quarky with PictoBlox.