The pyboard has a processor much better than commercial flight controllers, so we can made a flight controller similar or better written in python.
The main.py is based is this link:
<a href="http://owenson.me/build-your-own-quadcopter-autopilot/" target="_blank">http://owenson.me/build-your-own-quadcopter-autopilot/</a>
The mpu6050.py is a modified version from here:
<a href="https://github.com/cTn-dev/PyComms/tree/master/MPU6050" target="_blank">https://github.com/cTn-dev/PyComms/tree/master/MPU6050</a>
The pid.py is based from here:
<a href="https://github.com/diydrones/ardupilot" target="_blank">https://github.com/diydrones/ardupilot</a>
To receive the PWM from the RC receiver, I took the code from here:
<a href="http://wiki.micropython.org/platforms/boards/pyboard/modpyb/Timer-Examples" target="_blank">http://wiki.micropython.org/platforms/boards/pyboard/modpyb/Timer-Examples</a>
To control the speed controls, I take the code from here:
<a href="https://hackada
The pyboard build-in accelerometer only have accelerometer.... The mpu6050 have gyroscope and accelerometer. In the main.py are commented the code for use the build-in accelerometer:
#accel = pyb.Accel() imu = MPU6050()
.....
#x, y, z = accel.filtered_xyz() x, y, z = imu.get_xyz()
......
You only have to switch this commented lines.
The problem with the built-in accelerometer is that when you shake, it throw wrong data... I have checked the accelerometer documentation and it can determine shake movements, but this feature seems not implemented in the micropython pyboard.
Finally found this