- Scratch Based Default Extensions
- Artificial Intelligence
- Innovative Extensions
- Machine Learning Environment
- Quarky
- Quarky Intellio I2C Communication
- Quarky Advance Sensors Extension
- Quarky Connect
- Display (Quarky)
- Quarky (Main)
- Robot (Quarky)
- Sensors (Quarky)
- Speaker (Quarky)
- Quarky Ultimate Robots
- Quarky Expansion Board
- Mars Rover
- Humanoid (Quarky)
- Quadruped (Quarky)
- IoT House (Quarky)
- Quarky Mecanum
- Quarky Robotic Arm
- Dabble
- Quarky Advance Line Following
Sensors (Arduino Alvik)
Extension Description
Read Arduino Alvik’s onboard touch buttons, infrared line sensors, RGB colour sensor, Time-of-Flight distance sensor, and motion sensors using PictoBlox blocks and Python functions.
-
Available in: Block Coding, Python Coding
-
Mode: Stage Mode, Upload Mode
-
WiFi Required: No
-
Compatible Hardware in Block Coding: Arduino Alvik
-
Compatible Hardware in Python: Arduino Alvik
-
Object Declaration in Python: alvik = ArduinoAlvik()
-
Extension Catergory: Arduino Alvik
Introduction
The Sensors (Arduino Alvik) blocks allow users to interact with the robot’s built-in sensors and respond to changes in its surroundings. Arduino Alvik includes touch buttons, an infrared line-sensor array, an RGB colour sensor, a Time-of-Flight distance sensor, and a six-axis inertial measurement unit (IMU).
Using these blocks, you can:
- Detect button presses and count user interactions.
- Read infrared sensor values to identify contrasting surfaces.
- Detect colours and retrieve colour-related measurements.
- Measure distances and detect nearby objects.
- Identify selected robot orientations and physical states.
- Read motion-sensor measurements along different axes.
- Reset tracked rotation angles.
These blocks are useful for developing sensor-based automation, obstacle detection, interactive robots, colour recognition, and motion-aware robotics projects.

Connecting Arduino Alvik with PictoBlox
Before reading sensor data, connect Arduino Alvik to PictoBlox.
Follow the step-by-step instructions in the Arduino Alvik Connection Guide.
Read More
PictoBlox Blocks
All articles loaded
No more articles to load
Python Functions
This function checks whether the colour detected by Arduino Alvik matches the selected predefined colour code.
It returns True when the detected colour matches and False otherwise
Syntax: is_color( )
This function checks whether Arduino Alvik detects an upside-down orientation.
It returns True when the robot is upside down and False otherwise.
Syntax: is_robot_upside_down( )
This function checks whether Arduino Alvik detects a tilted orientation.
It returns True when the tilt condition is detected and False otherwise.
Syntax: is_robot_tilted( )
This function checks whether Arduino Alvik detects that it has been lifted.
It returns True when the lifted condition is detected and False otherwise.
Syntax: is_robot_lifted( )
This function resets the accumulated rotation reference for the selected axis.
It allows the robot to begin tracking a new rotation measurement.
Syntax: reset_rotated_angle( )
This function returns the accumulated rotation angle around the selected axis.
It is useful for monitoring how much Arduino Alvik has rotated relative to its tracked reference.
Syntax: get_rotated_angle( )
This function returns a selected motion or orientation measurement from Arduino Alvik’s inertial measurement unit (IMU).
Depending on the sensor type, it can provide acceleration, gyroscope, or orientation-related values along the selected axis.
Syntax: get_imu_value( )
This function checks whether an object is detected within the specified distance threshold.
It returns a Boolean value indicating whether the distance condition is satisfied.
Syntax: is_object_in_range( )
This function returns the distance measured by the selected Time-of-Flight sensor region.
It is useful for obstacle detection and distance-based navigation.
Syntax: get_distance_value( )
This function checks whether the selected onboard touch button is currently pressed.
It returns True when the button is pressed and False otherwise.
Syntax: get_touch_press( )
This function returns the numeric grayscale reading from Arduino Alvik’s colour sensor. It can be used to analyse differences in surface brightness.
Syntax: get_color_grayscale( )
This function returns the colour name detected by Arduino Alvik’s onboard colour sensor as a string.
It is useful for developing colour recognition and colour-based sorting projects.
Syntax: get_color_label( )
This function returns the selected RGB or HSV colour-sensor component.
It is useful for analysing colour intensity, hue, saturation, and brightness-related measurements.
Syntax: get_color_value( )
This function returns the numeric reading from the selected infrared line sensor.
It is useful for detecting contrasting surfaces and developing line-following robots.
Syntax: get_line_sensor( )
This function resets the recorded press count for the selected button to zero.
Syntax: reset_button_press_count( )
This function returns the number of button presses recorded for the selected onboard touch button.
Syntax: get_button_press_count( )
This function checks whether any onboard touch button is currently pressed.
It returns True if at least one button is pressed and False otherwise.
Syntax: get_any_button_pressed( )
All articles loaded
No more articles to load
Table of Contents
