Controller for Arduino

Controller for Arduino

 Controller for Arduino In this article, we will learn how to build a serial controller and use it to run the game on a computer. This homemade product will be interesting, first of all, for novice Arduino scholars.
Tools and materials: -Arduino Nano; -Breadboard; -Wire; -Resistor 10 kOhm; -Off button; -Variable resistor; -Potentiometer; -LED strip with 3 LEDs;
-Laser cutter; -Soldering accessories;
-Painting tape;
Step one: preparation of parts
First you need to prepare the accessories.
The button has three contacts. For this assembly, only two are needed. You need to solder one wire to the N0 pin, and two to the COM pin. One of these wires is soldered through a resistor.
Three wires must be soldered to the slide resistor to different pads.
The circuit uses a non-pixel LED strip. There are three contact pads on the ribbon. You need to solder wires to these pads.
The potentiometer also has three pads, to which wires are soldered.
Controller for Arduino  Controller for Arduino Controller for Arduino  Controller for Arduino Step two: schema
Next, you need to install the parts according to the diagram. The master used analog input pin 0 for the potentiometer, analog input pin 1 for the slider, digital pin 9 for the LED strip, and digital pin 8 for the button.
 Controller for Arduino Step three: the case
The wizard used the MakerCase program to design the case. Files for cutting parts can be downloaded below.
Controller for Arduino Step four: assembly
Next, assembles the case. Partly uses glue, partly masking tape to fix the parts.
Controller for Arduino  Controller for Arduino Step five: programming
First, you need to upload the code for interaction between components and Arduino. For the LED strip, you also need to install the Adafruit NeoPixel library.
The code can be downloaded below.
Next, you need to download the code for the game. The wizard gives the code, but any user can upload their own code for their game.
The wizard has downloaded the code from here. When this program is run with Arduino, it generates start code to receive serial output from Arduino in p5.js.
The code below defines the game logic and is written in p5.js.

 Controller for Arduino  To sketch the p5 code also an additional file called p5.serialport.js is required:  



Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also
Back to top button