628 octets ajoutés
, 24 février 2015 à 11:56
{{MicroPython-Hack-Prepare-NAV}}
== Introduction ==
{{bloc-etroit|text=Here you will learn how to read the accelerometer and signal using LEDs states like tilt left and tilt right.}}
== Utiliser l'accéléromètre ==
{{bloc-etroit|text=The pyboard has an accelerometer (a tiny mass on a tiny spring) that can be used to detect the angle of the board and motion. There is a different sensor for each of the x, y, z directions. To get the value of the accelerometer, create a pyb.Accel() object and then call the x() method.
<nowiki>>>> accel = pyb.Accel()
>>> accel.x()
7</nowiki>
{{MicroPython-Hack-Accelerometre-TRAILER}}