3 paddle controlled games


I have recently built homemade Arduboy with replaceable button hats.
I built a button hat with 10K VR as paddles that can be linked to a second brianless game console with similar paddles and buttons and OLED (but no ATMeag32U4).

You can also create a brainless console which is hooked up to the main game console by a 2 feet cable with a 15 pin header. The main console will drive a slave console with buttons, paddles and a second OLED.
The link cable should not go over 2 feet, otherwise, stability problem will start to appear. e.g. you cannot start up, or you cannot flash games stored in the Flash Cart.

I modified picovaders, ArduboyNG (Pong game for max. 2 players) and Breakout-V to work with the paddle. Here is the download link. The game source are in the Paddle Games directory.

I am not sure if you can add paddle to the original Arduboy, may be some modifications are required.
In case you want to try, here is the circuit diagrams of one of the four paddles you can add.

Note that a 2.2K is added before the output of the potentiometer goes into the ADC pins to avoid shortcircuit of VCC and Ground when someone pressed the corresponding D-PAD buttons while the VR is turned all the way up.
Similarly, a 4.7K resistor is put in series between one side of the potentiometer and ground to avoid triggering a button pressed situation when someone turned the VR all the way down and cause the ADC value below 380 (max is 1023 when VR is turned all the way up).
I used these type of tiny 10K potentiometers.

The value of the VR does not matter as long as it’s over 10K.
such as these. both are 10K

So, any analog joysticks or V.R. with a total 10K, 50K, 100K or even 150K will work. You just need to adjust the value of the 4.7K resister as follows:
10K = >4.7K
50K = > 22K
100K => 47K
150K = >68k
Refer to these youtube videos for how to build the paddle.

If you are interested on how the button hat is designed, you can refer to this video.

I have created a utility called PaddleTest to read the ADC values of the paddles and test if they can control the co-ordinates of the β€œ*” for player1 and β€œ@” for player 2 smoothly.

I have modified the following games to add codes for paddle control.
For each game, press β€œB” to start the game with paddle control. Press β€œA” to start the game with original D-PAD button controls.

Here are how I made the modifications

// global variable declarations
#define paddle1X A3
#define paddle1Y A2
#define paddle2X A1
#define paddle2Y A0
#define minPaddle 550
#define maxPaddle 1010
bool usePaddle = false;

// at game initiation
//Check  if B button pressed, use paddle as controller instead of D-PAD
    if (arduboy.pressed(B_BUTTON)) {
      power_adc_enable();  // enable ADC which is powered down by default to save battery life.
    else usePaddle=false; 

//at the place whether player movement are handled  change player1 and player 2 to paddel control
// this code sample is taken from ArduboyNGOnPaddle.ino
//ai1 , ai2 means the robot is driving the bat, not a human. So, only do paddle control when ai1,ai2  is not true
if (usePaddle) {
//we also need to first contrain the paddle returned ADC values by a range , before we use the map function
//otherwise, when the ADC values go off the edges, the bat will fall off the cliff and disappear.
if (not ai1)  ys1 = map (constrain (analogRead(paddle1X), minPaddle, maxPaddle), minPaddle, maxPaddle,YS_MIN, YS_MAX);    
if (not ai2)  ys2 = map (constrain (analogRead(paddle2X), minPaddle, maxPaddle), minPaddle, maxPaddle,YS_MIN, YS_MAX);    

Here is the link to the source and hex file for the three games. The game source are in the Paddle Games directory.

Credits to the original creator of these games.

ArduboyNGOnPaddle - with options for 2 player games, each controlling a paddle.
Using a 7-pin OLED link cable, you can also copy the screen to another brainless Arduboy console so
the two players can each watch their own tiny screen while paddling.

This is based on the original source created by Troubadixx
Please refer to the original source on https://github.com/troubadixx/ArduBOYNG/releases/tag/v0.81

picovaders-on-paddle - based on the original source created by boochow
Please refer to the original source on github https://github.com/boochow/picovaders

breakout-on-paddle - based on the original source created by boochow
Please refer to the original source on github https://github.com/boochow/breakout-v