kriddaw / L3G4200D

MicroPython class to use L3G4200D

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MicroPython port for L3G4200D

alt text


I2C 3 Axis Gyro on ESP32 Microcontroller

I used a couple existing scripts for arduino and raspi to put together this class. As you can see it outputs a dict of the xyz values of the sensor.

alt text


Usage

Instantiate I2C device, scan bus for i2c address, instantiate gyro object, run xyz_values method. Create loop to stream data.

from machine import Pin, I2C
from gy50 import GY50
i2c = I2C(scl=Pin(22), sda=Pin(21))
i2c.scan()
>>> [105]
address = 105
gyro = GY50(i2c, address)
gyro.xyz_values()
>>> {'x': -1.8, 'y': -0.5, 'z': 0.0}

About

MicroPython class to use L3G4200D


Languages

Language:Python 100.0%