Read Sensor Value

Read Sensor Value

This guide will show how to get readings from an analog and digital sensor connected to the Grove port.

Maker Uno RP2040 come with 6 Grove ports and one Maker port which are very useful for connecting various Grove modules and sensors easily. Not using Grove modules? No worries! you can use the provided Grove-to-female cables so you can still take advantage of this useful feature.

 

Analog Read

This figure below shows the Grove GPIO that you can use to read analog sensor value.

1. Connect your sensor module to the Maker Uno grove port. For this guide we will be using a Maker Soil sensor and connect it to Grove 5 port of the Maker Uno RP2040.

2. While your Maker Uno RP2040 is connected to your computer, open your editor software (for example Thonny). Select the code.py file in your drive.

3. Copy and paste the following code to your editor.

4. Flash the code to your Maker Uno RP2040. If succesful, the reading from the sensor should be display in the editor software shell. 

 

Digital Read

For digital sensor, you can use any of the Grove and Maker ports. For this example we will use a generic module of HC-SR04 Ultrasonic Sensor. 

1. Connect the Ultrasonic sensor to the Grove 2 port of the Maker Uno RP2040 via a Grove to 4 female pins cable.

2. While your Maker Uno RP2040 is connected to your computer, open your editor software (for example Thonny). Select the code.py file in your drive.

3. Copy and paste the following code to your editor.

4. Flash the code to your Maker Uno RP2040. If succesful, the reading from the sensor should be display in the editor software shell. 

Library file(s) required:
    adafruit_hcsr04.mpy

If you don't have this file in your computer, download the lib bundle here and search for this file inside the "lib" folder.