This week, we studied input devices in class. As an engineering student, I already had a lot of background with input devices, but I wanted to get a more intimate look.
I took some components from the Electrical Engineering Active Learning Labs to study on my own time, and to try to breadboard with them.
A few of the components were breakout boards that I would have to solder.
Here's a BNO055 that I soldered!
For this week's assignment I decided to use an analog joystick to create a Simon Says game.
First I tried to install example code from this website which had a tutorial on how to use an analog joystick with the ESP32C3 I was using.
And I built the circuit on a breadboard, following the same tutorial.
And it ran really properly! From the video you can see that the position of the stick varies the voltage in the X and Y direction, and that a low X voltage means rightward movement, a high X voltage means leftward movement, a low Y voltage means downward movement, and a high Y voltage means upward movement!
From there, I coded a simple Simon Says program on the Arduino IDE. It gave you a direction to go on the serial monitor and it would read the current direction your joystick was going, and after a certain amount of time it would check which direction you went. If you went the right way or the wrong way, it would let you know.
I had to do a bit of tweaking with variables and the sensitivities (like changing the thresholds to less than 0.3 and more than 3V to accommodate deadzones in the joystick) but it worked out pretty well!0.3>
That was it for this week! It was interesting to learn about how to program with inputs on the Xiao ESP32 compared to the Arduino boards I'd used in the past, and it was an interesting exercise in analog devices. I think for my project I will use a hall effect sensor as my input device. I would incorporate this week's project onto a PCB in the output week.