Simple test
Ensure your device works with this simple test.
examples/gp2y0e02b_simpletest.py
1# SPDX-FileCopyrightText: Copyright (c) 2023 Jose D. Montoya
2#
3# SPDX-License-Identifier: Unlicense
4
5import time
6import board
7import gpy
8
9
10i2c = board.I2C() # uses board.SCL and board.SDA
11
12# Initialize the MPL3115A2.
13gpy = gpy.GP2Y0E02B(i2c)
14
15while True:
16 gpy.read_distance()
17 time.sleep(0.2)