Code with the stabilisers

Hugo Zieg
3 min readApr 9, 2021

--

Due to the presence of the stabilising devices there is no longer a need for the robot to auto balance therefore I will be writing my own code that will allow my robot to navigate the course and rest at certain points. In order to do this i will be using the pin names that are used by elegoo themselves in the file called Pin.h

Pin.h file

I included the Pin.h file so my code could call upon these variables. I then used my coding knowledge to create a code that caused the robot to drive when the ultrasonic sensor was triggered. I then built upon my code using different function that will allow the robot to have a full range of movement.

With this code I have created functions that will make the robot drive, turn and stop. I then have ran them at different speeds and times to allow the robot to navigate through a course of set obstacles.

I initially tried to have it trigger these functions using sensors however this was not reliable and the robot was prone to glitching. Another problem experienced with using the sensors for navigation is that IR sensors typically work between 40 cm and 100cm therefore the obstacle course that we have been tasked with navigating is to small and intricate for these rudimentary sensors fitted to the robot. Also the 20 second stopping period would not have been possible with the sensor code. Another problem using a sensor code is due to the electrical components being used that left wheel is slower than the right wheel I will be able to compensate for this in my code whereas with the sensor code it would be difficult to compensate for. I will therefore be using this style of code to navigate the official maze.

For those interested there is a video of the robot fully functional on my instagram page!!

--

--