Example Code for Micropython-Acceleration Reading
Last revision 2026/01/07
This sample shows how to read acceleration values from the three axes for Micropython.
Hardware Preparation
You will need some extra hardware to convert this analog signal to a usable digital one. The Arduino is really good option for it. This break board is especially designed for Arduino which has 3 JST connector that can be easily plug into our IO/Sensor expansion board.
Software Preparation
- Development tools: Thonny
- Download link: Thonny
Wiring Diagram

Sample Code for Micropython
from machine import ADC,Pin
import time
x_adc=ADC(Pin(36))
y_adc=ADC(Pin(39))
z_adc=ADC(Pin(34))
while True:
print("x=",x_adc.read())
print("y=",y_adc.read())
print("z=",z_adc.read())
time.sleep_ms(50)
Was this article helpful?
