Week 14. Interface and Application Programming
This week we are learning about interface and application programming.

Individual Assignment:
Write an application that interfaces a user with an input &/or output device that you made
Group Assignment:
Compare as many tool options as possible
Interfacing with the Accelerometer
Sensors Used This Week and Useful Links
I wanted to interface with the accelerometer this week to visualise what was happening with the board on screen - ultimately I want to be able to visualise what will be happening with the Stewart Platform in my final project. However, for now, a simple cube will do. We will get to the Stewart Platform simulation a bit later.
I used the code I produced in Week 9 to interface with the accelerometer. I was going to have to learn Processing to allow the visualisation - I also wanted to leverage Cursor AI which I have been using since week 5 to write the code for me.
I tried the MPU6050 sensor which I couldn't get working in week 7 - the reason for this is I think I will be using an ESP32C3 and the BNO085 sensor is not recommended or compatible with the ESP32C3.
Below are screenshots from Cursor AI including all the prompts to create the code for both Arduino IDE and Processing.













And the results - see video below.

There was some drift as can be seen in parts of the video below.
I asked Cursor Chat if this could be resolved and it suggested some changes to the code, which I implemented.
It did improve but there was still some drift in the visualisation.
So back to Cursor to compare the MPU6050 with the BNO085.

See chat conversation below.





Its response led me to try it again with the Cube Visualisation.
The results were good with the BNO085 - no drift from what I could tell and it was giving me good results on screen.
I would now need to look to link this to a Stewart Platform to simulate it moving the top platform, but ultimately I want it to keep the top platform stable.

Issues I've Encountered
AGHHHHH!
What went wrong:
I had issues getting sample code working that came with the MPU6050 library.
Issues with the Cursor-generated code not using the correct USB port - that was an easy fix.
I attempted to add a button to reset the position of the cube - with the BNO085 it was causing the cube to move in a weird way - I will need to look into this.
When I first tried to run the Processing code I was getting issues with the serial port being in use - I was using Serial Monitor in the Arduino IDE while trying to access it at the same time in Processing - only one can be in use at a time.

Learning Outcomes

Code structure and how the types of flow required - I will need to explore more of this, but this week has given me a good grounding.
I have a good grounding in the Arduino IDE and have a good understanding of the code structure and how the types of flow required.