Rotary Angle Sensor

A rotatable input knob (potentiometer) that can be turned up to 300° and produces a linear analog output between 0 and the operating voltage (3.3 V). This is distributed by the analog-digital converter of the Calliope mini in the value range between 0 and 1023.

Further information to the sensor you will find here.

port: A1
interface: analog
output values

1 - 1019


In MakeCode you can output the values of the Grove potentiometer via RX pin C16. To do this, go to the advanced blocks Pins and select the block analog values of pin P1 and change the pin accordingly to C16.
Since you usually want to permanently query the rotation of the potentiometer, the output should be in a permanent loop.

Map numbers
It may be useful to map the numbers from the range of values of the potentiometer into a new range of values, depending on the application. Under the category Mathematics you can find the block distribute 0 from low 0 from high....


Open Roberta Lab

First you have to configure an analog sensor for pin C16 in the robot configuration.
The next step is to select the block give analog value pin in the program editor under the tab Sensor.
This can then be placed as input in a repeat infinitely loop to permanently query the status of the potentiometer.

Map numbers
Also included in the program code of the XML is a mapping function to transfer the range of values of the potentiometer between 0 and 1023 to a new one, such as 0 - 9.


You can find sensor and actuator projects that have already been realised on the project page.

Other Projects