Here is a link to the code to run the Pong game. This link also shows you another way to setup the Pong game. Code is in a downloadable zip.file link near the bottom of the webpage.
Components: breadboard, arduino board, buttons, wires:
How to set up:
1 Arduino Uno Board
1 Uno Board USB Power Cord
1 0.95 inch color OLED display
2 Black wires
2 Blue wires
2 Orange wires
2 Yellow wires
2 Green wires
1 Red wire
1 White wire
Attaching the OLED screen:
The OLED screen has 7 pins. The pins are named (left to right): GND, VCC, SCL, SDA, RES(Reset), DC and CS. Press the pins of the OLED board into the breadboard in slots f10-f16 so that the GND pin is in f10 and the CS pin is in f16.
2.) Attaching the gaming buttons:
Each game button has 4 pins. The button on the left will make the pong paddle move down on the screen when pressed. The button on the right will make hte pong paddle move up on the screen. The pins for the left button go in slots f45, f47, e45 and e47. The pins for the right button go in slots f55, f57, e55 and e57.
3.) Attaching the wires for the OLED screen:
Black wires goes from h10 to blue negative rail on breadboard.
White wire goes from h11 to the 3.3V slot on the Arduino board.
Green wires goes from h12 to slot 13 on Arduino board.
Yellow wire goes from h13 to slot 11 on Arduino board.
Red wire goes from h14 to slot 9 on Arduino board.
Blue wire goes from h15 to slot 8 on Arduino board.
Orange wire goes from h16 to slot 10 on Arduino board.
4.) Attaching the game button wires:
Black wire goes from i45 to blue negative rail.
Yellow wires goes from i47 to slot 3 on Arduino board.
Blue wire goes from i55 to blue negative rail.
Orange wire goes from i57 to slot 2 on Arduino board.
Green wire goes from slot GND on Arduino board rail labeled “POWER” to a slot on the blue negative rail of the breadboard.
5.) Power up and Code.
Plug the power USB wire into the Arduino board and connect to computer. Open Arduino software and upload the code for Pong. Your game should be ready to play now.
Xem thêm bài viết khác: https://hellameke.com/game/