Table of Contents


Function Definition: wifi()



The function creates an object to connect Quarky with Wi-Fi.

import iot

wifi = iot.wifi()


Learn how to connect your Quarky to a WiFi network and troubleshoot any connection issues. Follow the guide to ensure a successful connection.

In this example, we look at how to establish and see if the Wi-Fi is connected to Quarky or not. The code will connect the Quarky to a specified WiFi network and show a green status if the connection is successful, or a red status if the connection fails.

Alert: Quarky’s WiFi connection ability is only available when using the Upload Mode in Pictoblox. This mode allows users to write scripts and upload them to the board so they can be used while the board is not connected to a computer. This is useful for running scripts without a computer connection.


# imported modules
from quarky import *
import iot

# Create a Wi-Fi object
wifi = iot.wifi()

# Change the Wi-Fi Name and Password
wifi.connecttowifi("IoT", "12345678")

# Run the loop to check if the Wi-Fi is connected
while True:
  # Check if the Wi-Fi is connected
  if wifi.iswificonnected():
    # Draw a pattern on the quarky

    # Draw a different pattern on the quarky
  1. This code is using the Quarky library to draw a pattern depending on the status of the WiFi connection. If the WiFi connection is successful, it will draw the green light on the Quarky LEDs. If the Wi-Fi connection is unsuccessful, it will draw a red light on the Quarky LEDs.
  2. Additionally, it imports the iot module and connects to a Wi-Fi network with the name specified name and the password.
  3. It also has a while loop that checks to see if the Wi-Fi is connected and will draw the appropriate pattern accordingly.


Alert: If you do not yet have the IoT House assembled, please refer to this document to guide you through the assembly process:


  1. If the Green Light is displayed, your Wi-Fi is connected.
  2. If the Red Light is displayed, your Wi-Fi is not connected. Change the Wi-Fi and the password and try again.
  3. If the Red Cross sign is displayed, a Python error has occurred in Quarky. Check the serial monitor and try to reset the Quarky.
Read More
All articles loaded
No more articles to load