Read Sensor Value

Read Sensor Value

This guide will show you how to read the analog and digital sensor value from Maker Port or GPIO breakout.

Analog Read

The figure below shows the GPIO that can read analog sensor value.
Note: You may look for the pins labelled "A_" on the board.

1. While your MOTION 2350 Pro is connected to your computer, open your editor software (for example Thonny). Select the code.py file in your drive.

2. Connect your analog module to the MOTION 2350 Pro, to Maker Port  with GP 26 & GP27 using JST-SH to 4 female pins / grove cable.
OR connect to the GPIO breakout using male-to-female jumper wires together with grove cables (if applicable).
Example module used: Octopus Analog Rotation Brick OBARot

 

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

4. Flash the codes to your MOTION 2350 Pro. And your CIRCUITPY drive should look like this (no lib file is used):

Digital Read

We will show all 2 types of connections for this application, including Maker Port and GPIO Breakout.
In this example, we will use the generic module of HC-SR04 Ultrasonic Sensor and Grove Ultrasonic Sensor as an illustration.
 
1. While your MOTION 2350 Pro is connected to your computer, open your editor software (for example Thonny). Select the code.py file in your drive.

2. Connect your sensor module to the MOTION 2350 Pro, to Maker Port  with GP 26 & GP27 using JST-SH to 4 female pins / grove cable.
OR connect to the GPIO breakout using male-to-female jumper wires.

Generic Module:

Grove Module:

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

4. Flash the codes to your MOTION 2350 Pro. And your CIRCUITPY drive should look like this:

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.

Hardware Components