mirror of
https://gitlab.waag.org/make/fablab/interns/2025/sam.git
synced 2025-08-03 03:44:58 +00:00
docs programming
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
## Introduction
|
||||
I'm very familiar with coding in C++ because of my university. At the moment im studying computer sciences at the Applied University of Amsterdam.
|
||||
|
||||
## First code before deciding to using existing code
|
||||
## First code to read from the BNO085
|
||||
I first wanted to create the drone firmware myself. But then I looked through some research papers and existing programs and saw all the math that was needed to keep it upright. Then I decided to modify an existing program.
|
||||
This was my first attempts at getting the sensor to read
|
||||
|
||||
@@ -149,5 +149,43 @@ In this case minVal is 800 an maxVal is 2200. So we need to stay between these r
|
||||
|
||||
[ESC calibration](https://ardupilot.org/copter/docs/esc-calibration.html)
|
||||
|
||||
#### Attaching the esc's to the correct pin.
|
||||
### Switching to platformIO.
|
||||
At the local lecture we got thought how to use platformIO. I was already used to Arduino IDE v2. But I found the UI and the speeds of PlatformIO very nice so that's why I decided to switch to PlatformIO.
|
||||
|
||||
First off. I created a new project with the Xiao espC3 because the espC6 isn't registered on the list. I've googled a bit and that's because PlatformIO needs to get profit so they ask money to the board developers to add the board to their platform. So we need to set the correct board later on.
|
||||

|
||||
When it created the project. I copied all the files over to the src folder and renament my drone.ino to main.cpp. Now I had a lot of include errors because Arduino IDE automatically imports everything and with PlatformIO you need to define everything yourself. So I started out in the Library manager installing all the libraries to the project I needed.
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
#### Setting the correct board
|
||||
|
||||
Before
|
||||
```ini
|
||||
[env:seeed_xiao_esp32c3]
|
||||
platform = espressif32
|
||||
board = seeed_xiao_esp32c3
|
||||
framework = arduino
|
||||
```
|
||||
|
||||
After
|
||||
```ini
|
||||
[env:seeed_xiao_esp32c6]
|
||||
platform = https://github.com/mnowak32/platform-espressif32.git#boards/seeed_xiao_esp32c6
|
||||
platform_packages =
|
||||
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
|
||||
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
|
||||
framework = arduino
|
||||
board = seeed_xiao_esp32c6
|
||||
```
|
||||
|
||||
To get the correct configuration if it isn't listed on PlatformIO, is to go to the Board manufactors website and hope there is a PlatformIO example configuration. For example this example was listed on the Xiao website. [Link](https://wiki.seeedstudio.com/xiao_esp32c6_with_platform_io/).
|
||||
|
||||
#### Using PlaformIO
|
||||
Using platformIO is really straight forward. The only folder you should look at in your platformIO project is the `src` folder.
|
||||
|
||||

|
||||
|
||||
In the main.cpp file you can write your program.
|
Reference in New Issue
Block a user