Led Toggle With Switch
This project demonstrates an IoT-based control system in which Quarky receives the status of a Light feed from Adafruit IO and responds automatically. When the received value is “ON”, the system displays a pattern on the matrix, moves Motor 1 forward at 52% speed, and sets Servo 5 to 40°. When the value is not “ON”, the motor is stopped, the display is cleared, and Servo 5 is moved to 120°.
Supplies
3. Hardware and Software Requirements
- Quarky / Quarky Expansion Board
- Motor connected to Motor 1
- Servo connected to Servo 5
- Built-in LED matrix/display
- Computer or laptop with PictoBlox
- Internet connection
- Adafruit IO account and Light feed
- PictoBlox with the required Quarky and Adafruit IO blocks
Block-by-Block Explanation
- When Green Flag Clicked: Starts the program.
- Initialize Quarky Expansion Board: Prepares the Quarky hardware for operation.
- Set Display Brightness to 10: Sets the brightness level of the display matrix.
- Connect to Adafruit IO: Establishes communication with the cloud service using the configured username and AIO key.
- Forever: Keeps the control process running continuously.
- Get Last Data from Feed “Light” as String: Retrieves the latest Light feed value from Adafruit IO.
- If Value = “ON”: Checks whether the received command is ON.
- Display Matrix: Shows the programmed visual pattern when the Light status is ON.
- Run Motor 1 Forward with 52% Speed: Moves the connected motor forward at the specified speed.
- Set Servo 5 to 40°: Positions the servo at 40 degrees in the ON state.
- Else: Executes the alternative actions when the Light value is not ON.
- Stop Motor 1: Stops the motor.
- Clear Screen: Removes the matrix display.
- Set Servo 5 to 120°: Moves the servo to 120 degrees in the OFF/non-ON state.
Working Principle
The project uses Adafruit IO as the communication layer between the user’s IoT command and the Quarky hardware. The Light feed acts as a remote control input. Quarky repeatedly checks the latest feed value. A value of “ON” activates the programmed outputs, while any other value causes the system to enter its alternate state. This makes the project a simple example of cloud-connected automation.
Input–Process–Output
Adafruit IO Light feed = ON
Condition is TRUE
Matrix ON, Motor forward at 52%, Servo = 40°
Adafruit IO Light feed ≠ ON
Condition is FALSE
Motor stopped, screen cleared, Servo = 120°
Expected Outcome
- The system responds to the latest Light feed value from Adafruit IO.
- When the feed is ON, the motor operates and the servo moves to the ON position.
- When the feed is not ON, the motor stops and the servo returns to the alternate position.
- The display provides an additional visual indication of the active state.
- The control process continues automatically without requiring the program to be restarted.
Possible Applications
- IoT-based vehicle or robotic control.
- Remote-controlled automation systems.
- Smart lighting or indicator systems.
- Cloud-controlled robotic mechanisms.
- Educational demonstrations of IoT, robotics and automation.
Conclusion
The project successfully demonstrates the integration of IoT communication, block-based programming and physical computing. By using Adafruit IO as a remote input and Quarky as the control platform, the system can automatically operate a motor, servo and display according to the received Light status. The project provides a practical introduction to IoT-enabled robotics and automation.