Cov txheej txheem:

LED Sawb Atari Pong Arcade Tshuab: 8 Kauj Ruam
LED Sawb Atari Pong Arcade Tshuab: 8 Kauj Ruam

Video: LED Sawb Atari Pong Arcade Tshuab: 8 Kauj Ruam

Video: LED Sawb Atari Pong Arcade Tshuab: 8 Kauj Ruam
Video: The Atari 2600 junior console 2024, Kaum ib hlis
Anonim
LED Sawb Atari Pong Arcade Tshuab
LED Sawb Atari Pong Arcade Tshuab

Kuv lub npe yog Gabriel Podevin thiab qhov no yog thawj zaug kuv nkag siab tau. Tam sim no kuv yog menyuam kawm ntawv theem siab 16 xyoo uas nyiam tsim thiab tsim khoom thaum lub sijhawm xav tau cov khoom siv hluav taws xob, neeg hlau, kev siv hluav taws xob, thiab kev ua haujlwm. Kuv vam tias koj tuaj yeem pom qhov no nkag siab tau pom qhov no muaj txiaj ntsig.

Hauv cov lus qhia no kuv yuav qhia koj yuav ua li cas ua kom rov zoo li qub Atari Pong Game hauv rooj plaub retro arcade. Koj tuaj yeem pom cov vis dis aus saum toj no rau qhov ua piv txwv ntawm qhov haujlwm, koj tseem tuaj yeem pom qhov project tiav thiab rooj plaub ib leeg thiab hauv ob daim duab. Qhov kawg ntawm qhov tsis nkag siab no kuv yuav dhia tob rau hauv cov cai thiab yuav kho nws li cas kom nws tus kheej.

Cov npe yooj yim yuav muab faib ua ntu: Cov cuab yeej, cov khoom sib dhos thiab cov khoom siv

Cov cuab yeej uas koj xav tau yuav suav nrog cov hauv qab no:

- Laum

- Soldering Hlau

- Ntsia tus tsav tsheb (sib dhos cov screws koj txiav txim siab siv)

- Ntau Meter

- ncig pom, saw pom, lossis lub tshuab txiav laser yog koj tau nkag mus rau ib qho

-Wire cutter los yog txiab

- Phom phom

Qhov uas koj xav tau rau kev sib dhos yuav suav nrog

- Ntoo kua nplaum

- 10 ib nti los ntawm ib nti ntoo ntawm cov ntoo

- daim ntawv loj ntawm peb lub hlis nti ply ntoo lossis ntoo xaiv

- 24 ntsia hlau ib nrab ntiv tes ntev

- 14 x 6.5 nti ntawm coj cov yas nthuav dav (xaiv tau)

- kab xev liab thiab xiav hluav taws xob

Cov cheebtsam uas koj yuav xav tau yog:

-2 100k ohm potentiometers

- 8 metres ntawm tus kheej qhov chaw nyob coj tus coj (30 leds ib 'meter')

www.amazon.ca/ALITOVE-WS2812B-Individually-Addressable-Waterproof/dp/B018XAELE4/ref=sr_1_1?s=hi&ie=UTF8&qid=1535323567&sr=1-

- ob peb meters ntawm xaim lossis ntau xim ntawm xaim

- ac rau dc lub zog hloov pauv uas tso tawm 6v los ntawm lub thoob ntsaws ntsaws

- 1 arduino Uno R3

yog tias koj tsis muaj kev nkag mus rau Arduino Uno R3 zoo li kuv tus kheej koj tuaj yeem tsim ib qho zoo li ib qho uas kuv yuav siv hauv txoj haujlwm no uas siv lub tshuab atmel328-pu. Ua raws qhov txuas no txhawm rau kawm tsim koj tus kheej

Yog tias koj tab tom siv arduino uno txuas ntxiv mus rau theem ib.

Kauj Ruam 1: Tsim LED Array

Tsim lub LED Array
Tsim lub LED Array
Tsim lub LED Array
Tsim lub LED Array
Tsim lub LED Array
Tsim lub LED Array

Cov kauj ruam no yog lub sijhawm siv sijhawm yooj yim tshaj plaws los ntawm txhua qhov kev txhuam koj yuav tsum tau ua.

-to pib koj yuav xav tau 10 3/4 nti los ntawm 6 1/2 nti ntoo.

-thaum koj muaj koj daim ntoo, tuav koj daim kab xev Led thiab txiav 26 ntu txhua 10 coj lossis txhua 6 1/2 ntawm ib nti.

-after txiav cov ntu ua kua nplaum rau hauv koj cov ntoo ntsug zoo li qhia hauv cov duab hauv qab no pom hauv thawj daim duab saum toj no.

-thaum koj tau glued cov kab txaij thiab tso cai rau lawv los daws peb yuav pib soldering.

-yog koj yuav xav tau peb xim sib txawv xim

-it yuav tsum tau xaim nrog txhua qhov zoo txuas rau ib lub xaim thiab txhua qhov tsis zoo txuas rau ib lub xaim thaum lub xaim kawg yuav ua rau cov hlua coj ua ke. Cov duab thib ob thaum pib ntawm cov kauj ruam no yog daim duab uas yuav qhia koj yuav ua li cas txuas cov xov hlau.

-Thaum kawg tom qab koj tau muab lawv muag rau koj koj yuav yooj yim qhwv ib txoj hlua hluav taws xob ntawm koj qhov txuas txuas nrog cov xim sib xws. raws li qhia hauv daim duab thib peb saum toj no.

-kawg peb yuav txuas rau Arduino. koj cov tswv yim digital lossis koj cov xov hlau nruab nrab yuav txuas rau koj cov lej digital 6 tus lej thiab koj hauv av thiab qhov zoo yuav txuas rau txoj kab zoo thiab tsis zoo ntawm lub rooj tsavxwm.

Kauj Ruam 2: Lub Paddle Controls

Paddle Controls
Paddle Controls
Paddle Controls
Paddle Controls
Paddle Controls
Paddle Controls

Rau cov kauj ruam yooj yim heev no txhua yam koj yuav tsum tau ua yog txuas peb kab rau txhua lub hwj chim. yog tias koj tuav lub hwj chim ntsuas nrog cov ntsiab lus ntawm lub ntsej muag tig los ntawm koj lub xub pwg sab laug yuav yog qhov zoo tshaj plaws qhov chaw nruab nrab yog qhov tso tawm thiab txoj cai prong yuav yog hauv av. raws li qhia hauv daim duab saum toj no

ib zaug koj tau xaim cov xov hlau ntawm peb yuav txuas lawv mus rau Arduino. koj muaj peev xwm thiab tsis zoo yuav txuas mus rau qhov muaj qhov cuam tshuam zoo thiab tsis zoo los nag. koj tso cov xov hluav taws xob ntawm lub hwj chim yuav txuas rau cov tswv yim sib txawv ntawm arduino. ib qho yuav txuas rau (A0) ntsaws thiab lwm qhov yuav txuas rau (A1) ntsaws.

Kauj Ruam 3: Txiav Rooj plaub

Txiav Case
Txiav Case
Txiav Case
Txiav Case
Txiav Case
Txiav Case
Txiav Case
Txiav Case

ntu no yuav muab rau koj qhov ntev thiab cov ces kaum ntawm yam koj yuav xav tau txiav

**** tseem ceeb heev ***** nco ntsoov tias koj cov ntoo yog peb lub hlis tuab tuab (1/4 nti)

kuj thaum txiav qhov tawm nco ntsoov sau koj cov khoom

qhov yooj yim los txiav yuav sau rau hauv qab, rov qab, sab saum toj, pem hauv ntej saum, hauv qab hauv qab…. pom hauv cov duab thaum pib

ib feem qhov ntev

- Hauv qab: 13 3/4 nti X 10 1/4 nti

- Rov qab: 13 3/4 nti X 15 1/2 nti

- Sab saum toj: 13 3/4 nti X 6 1/2 nti

- Hauv ntej hauv qab: 13 3/4 nti X 4 1/4 nti

- Dial Vaj Huam Sib Luag: 13 3/4 nti X 6 nti

- Sab hauv sab: 13 3/4 nti X 3 1/4 nti

- LED sab: 6 1/4 nti X 1 nti (txiav ob qho ntawm no)

- LED Sab hauv qab: 13 1/4 nti X 4 1/2 nti

- sab hauv rov qab LED vaj huam sib luag: 13 1/4 "X 9"

- Thaiv: 1 nti X 1 nti X 1 nti (txiav 10 blocks)

- Acrylic vaj huam sib luag: 13 3/4 nti X 6 1/2 nti

Cov duab saum toj no yuav qhia koj cov ces kaum thiab qhov ntev ntawm sab vaj huam sib luag. kuj koj yuav tsum txiav ob qho ntawm ntu no

Kauj Ruam 4: Rooj Sib Tham

Rooj Sib Tham
Rooj Sib Tham
Rooj Sib Tham
Rooj Sib Tham
Rooj Sib Tham
Rooj Sib Tham

Los ntawm qhov no hauv cov lus qhia no koj yuav luag tiav tag nrho. tso koj tej zaum xav tias kuv muaj tag nrho cov ntu no thiab txiav tawm yam kuv yuav ua nrog lawv. Cov kauj ruam kawg no yuav qhia koj yuav ua li cas los sib sau koj rooj plaub.

Thawj qhov peb yuav mus yog pib sib sau rooj plaub. qhov no yog qhov uas txhua yam koj tau txiav ntoo los ntawm cov kauj ruam dhau los ua ke.

-Txhawm rau pib ua ke peb yuav xav tau 4 ntawm 1x1x1 cov ntoo ntawm lub hauv paus, ob sab vaj huam sib luag, nraub qaum thiab hauv qab hauv ntej. muab 4 lub thaiv rau txhua lub ces kaum hauv qab thiab tawm ib lub hlis twg ntawm nruab nrab ntawm ntug thiab qhov thaiv raws li qhia hauv daim duab thib ob ntawm kev thov ntawm cov kauj ruam.

-exte koj yuav xav tau laum qee qhov kev sim los ntawm cov ntoo thiab cov thaiv. ib zaug koj tau ua cov ntsia hlau ntawd mus rau hauv qab.

-Tom ntej no peb yuav muab cov ntawv sib dhos tso rau. Muab cov vaj huam sib luag tso rau ntawm peb lub hlis nti sib nrug ntawm sab nrauv ntawm lub thaiv. laum ib lub dav hlau los ntawm lub vaj huam sib luag sab thiab cov ntoo thaiv thiab ntsia hlau rau hauv. rov ua dua rau lwm sab.

-Thaum ua tiav cov ntawv sab. peb yuav muab tso rau pem hauv ntej vaj huam sib luag hauv qab. tso lub vaj huam sib luag yaug nrog hauv qab thiab ob sab siv lub qhov qhov tsav mus rau hauv cov thaiv thiab ntswj lub vaj huam sib luag rau.

-Thaum kawg peb yuav muab tso rov qab. ua tib yam li koj tau ua nrog lub vaj huam sib luag hauv qab hauv ntej thiab ntsia koj rov qab.

-By los ntawm qhov no koj muaj lub hauv paus los tsim thiab nkag siab txog yuav ua li cas peb sib sau rooj plaub no.

-Qhov txuas ntxiv no yog qhov nyuaj me ntsis vim qhov koj ua haujlwm nrog thaj tsam me dua. kom pib peb yuav xav tau tag nrho cov ntu sab saum toj thiab 6 ntu.

-Qhov yam koj tau tsim kom deb li deb ntawm nws nraub qaum thiab tso cov thaiv nyob rau hauv lub ces kaum ib nti los ntawm sab saud. (raws li qhia hauv daim duab thib peb thaum pib)

-Txhob tsav lub qhov rau ob sab thiab nraub qaum thiab ntsia hlau rau hauv.

-Ntawm no peb yuav sib sau ua ke rau sab saud

-take koj lub vaj huam sib luag sab saum toj thiab muab nws tso rau ntawm cov blocks xyaum cov qhov qhov av thiab ntsia hlau rau sab saum toj. Tom qab koj Finnish uas tig koj lub rooj sib txoos upside down *** ua tib zoo *** thiab tso ib qho thaiv hauv txhua lub ces kaum nrog rau ntug. laum cov qhov tsav los ntawm cov vaj huam sib luag sab thiab ntswj lawv mus rau qhov thaiv. tig cov ntaub ntawv rov qab ncaj thiab laum qhov ntsuas qhov ntsuas los ntawm sab saum toj rau hauv cov thaiv thiab ntsia hlau rau hauv.

-Qhov zes no yog qhov ua kom me ntsis. koj yuav xav tau koj lub vaj huam sib luag sab saum toj thiab koj ob qhov kawg. thawj qhov xyaum qhov qhov rau hauv cov thaiv yav dhau los los ntawm koj lub vaj huam sib luag pem hauv ntej thiab ntsia hlau rau hauv. ib zaug ntxiv tig cov ntaub ntawv rov qab thiab tso rau sab hauv lub vaj huam sib luag sab hauv ntawm lub thaiv thiab ntsia hlau rau hauv.

-you yuav tsum tau sab laug nrog qee yam zoo li no (pom hauv thawj daim duab ntawm theem no)

cov kauj ruam tom ntej yuav piav qhia qhov seem ntawm lub rooj sib txoos.

Kauj Ruam 5: Ua Kom tiav Lub Rooj Sib Tham

Tiav Lub Rooj Sib Tham
Tiav Lub Rooj Sib Tham
Tiav Lub Rooj Sib Tham
Tiav Lub Rooj Sib Tham
Tiav Lub Rooj Sib Tham
Tiav Lub Rooj Sib Tham

Los ntawm qhov no koj yuav luag ua tiav rooj plaub thiab tsim tsuas yog qee yam uas yuav muab tso rau hauv thiab koj yuav ua tiav.

Tam sim no txhua yam tseem tshuav yog teeb tsa cov khoom siv hluav taws xob.

-Peb yuav pib los ntawm kev khawb qhov rau hauv koj lub vaj huam sib luag rau koj lub hwj chim. xav tias dawb los laum cov qhov uas koj xav tias nws yuav xis nyob. hauv kuv qhov xwm txheej kuv tau tso lub qhov 2 1/2 ntiv tes los ntawm hauv qab thiab 3 1/2 ntiv tes los ntawm sab rau ob lub zog loj.

-Thaum koj tau laum koj lub qhov peb yuav muab lub vaj huam sib luag no tso rau hauv rooj plaub. tab sis tsis txhob ntswj nws rau ntawm peb yuav tsum tau lo nws yooj yim muab cov nyiaj ntau ntawm cov kua nplaum rau ntawm rooj plaub ntug thiab tso lub vaj huam sib luag rau thiab tuav nws nrog qee qhov clamps lossis qee yam hnyav.

-Thaum cov kua nplaum ua kom qhuav tas lawm peb yuav muab tso rau hauv cov khoom siv hluav taws xob. Tab sis ua ntej peb yuav tau tshem lub vaj huam sib luag tom qab.

-Thaum lub nraub qaum raug tshem tawm Kuv pom zoo kom koj tso rooj plaub pem hauv ntej kom yooj yim dua rau tso cov LEDs thiab lwm yam khoom sab hauv.

-Tam sim no koj muaj lub nraub qaum tawm peb yuav tso lub hwj chim hauv lub rooj los ntawm kev yooj yim tso lawv hla lub qhov peb tsuas yog drilled thiab muab cov dej sov ua siab dawb pub dawb.

*** ceev faj ***-Ua tib zoo saib xyuas thaum tso cov LED teeb rau hauv vim tias cov ntsiab lus sib txuas tuaj yeem tawg tau.

-Tam sim no peb tau mus txog qhov tseem ceeb tshaj plaws, tso rau hauv cov kab coj. yooj yim tso lub rooj tsavxwm raws li qhia hauv daim duab thib ob.

-Thaum koj tau txais koj lub vaj huam sib luag sab hauv thiab muab tso rau hauv rooj plaub ncaj qha hauv qab ntawm LED teeb rov qab vaj huam sib luag. daim ntawv no tuaj yeem ua rau kuv haum nruj. tseem cia nws qhuav ua ntej txuas ntxiv mus.

-Koj tau mus txog ntu kawg. Kuv pom zoo pleev xim ib sab ntawm ntu kawg no (LED Sab Hauv) dub lossis dawb rau qhov sib piv ntawm LEDs thiab ntu no.

-Peb yuav paub tso qhov no ncaj qha tom qab LED thim rov qab thiab maj mam nias tawm tsam sab nraum qab ntawm LEDs kom lawv tsis txhob txav mus. ib zaug muab tso rau hauv cov kua nplaum raws ntug kom tiv thaiv nws txav mus los. qhia hauv daim duab thib peb.

**** zoo siab nrog koj tau ua tiav kev sib dhos tag nrho !!!

txuas ntxiv mus rau cov kauj ruam kawg los ua tus lej game

Kauj Ruam 6: Txoj Cai

Pab kev zoo siab ib zaug ntxiv ntawm kev ua kom nws nyob deb.

hauv ntu no kuv yuav qhia koj txoj cai thiab yuav ua li cas kom nws ua haujlwm ntxiv rau cov khoom hauv txoj cai koj tuaj yeem hloov pauv thiab kho nws tus kheej.

tab sis ua ntej peb nkag mus rau qhov uas koj yuav xav tau (adafruit_NeoPixel-master) kuv tau txuas rau rub tawm ib yam nkaus.

txhawm rau txhim kho tus tswv qhib koj qhov program arduino

1. mus rau kos duab

2. qhib nrog lub tsev qiv ntawv

3. nyem (add.zip tsev qiv ntawv)

4.select (adafruit_NeoPixel-master) cov ntaub ntawv thiab koj ua tiav

hauv qab no kuv tau sau cov cai rau qhov kev ua si.

#suav nrog

#suav nrog

ntev ballXabs = 12;

ntev ballYabs = 4;

koj ballX;

koj ballY;

int ballvelX = 1;

int ballvelY = 1;

koj index;

koj fps = 50;

int paddlewidth = 3;

int paddlemax = 9 - paddlewidth + 1;

int pob qhov rooj = 1023 / (paddlemax);

int paddle1 = 4;

int paddle2 = 4;

#define NUMPIXELS 260

#Txhais tus lej PIN 6

Adafruit_NeoPixel pixels = Adafruit_NeoPixel (NUMPIXELS, PIN6, NEO_GRB + NEO_KHZ800);

void teeb tsa () {

pixels.begin ();

Serial.begin (9600);

}

void voj () {

clearScreen ();

updateBall ();

updatePaddle1 ();

updatePaddle2 ();

displayBall ();

displayPaddle1 ();

displayPaddle2 ();

pixels.show ();

detectCollision ();

ncua (fps);

}

tsis muaj dab tsi clearScreen () {

rau (int kuv = 0; kuv <NUMPIXELS; kuv ++) {

pixels.setPixelColor (i, pixels. Color (0, 0, 0));

}

}

void updateBall () {

ballXabs += ballvelX;

ballYabs += ballvelY;

}

void detectCollision () {

Serial.print (ballYabs);

Serial.print ("");

Serial.println (paddle1);

yog (ballvelX> 0 && ballXabs> = 25) {// tsoo phab ntsa sab xis

Serial.println ("Sib tsoo X");

qhab nia 1 (); // ballvelX*=-1;

}

yog (ballvelX <0 && ballXabs <= 0) {// tsoo phab ntsa sab laug

Serial.println ("Sib tsoo X");

qhab nia 2 (); // ballvelX*=-1;

}

yog (ballvelY> 0 && ballYabs> = 9) {// tsoo phab ntsa saum toj

Serial.println ("CollisionY"); ballvelY *= -1;

}

yog (ballvelY <0 && ballYabs <= 0) {// tsoo phab ntsa hauv qab

Serial.println ("CollisionY");

ballvelY *= -1;

}

// ntes paddle 2 kev sib tsoo

yog ((ballvelX> 0 && ballXabs == 24) && ((ballYabs> = paddle2) && (ballYabs <= paddle2 + paddlewidth - 1)))

{// tsoo phab ntsa sab xis

Serial.println ("CollisionPaddle");

ballvelX *= -1;

}

// ntes paddle 1 kev sib tsoo

yog ((ballvelX = paddle1) && (ballYabs <= paddle1 + paddlewidth - 1)))

{// tsoo phab ntsa sab xis

Serial.println ("CollisionPaddle");

ballvelX *= -1;

}

}

void updatePaddle1 () {

int pob qhov rooj = analogRead (A0);

paddle1 = puag ncig ((ntev) pob qhov rooj / (ntev) pob qhov rooj);

}

void updatePaddle2 () {

int pob qhov rooj 2 = analogRead (A1);

paddle2 = puag ncig ((ntev) pob qhov rooj 2 / (ntev) pob qhov rooj);

}

void displayBall () {

ballX = puag ncig (ballXabs);

ballY = puag ncig (ballYabs);

yog (ballX % 2! = 0) {

index = (9 - ballY) + 10 * ballX;

yog (ballX! = 0) {

pixels.setPixelColor (ballY + 10 * (ballX - 1), pixels. Color (30, 0, 0)); // sab laug ntawm pob xim

}

yog (ballX! = 25) {pixels.setPixelColor (ballY + 10 * (ballX + 1), pixels. Color (30, 0, 0)); // sab xis ntawm pob xim

}

yog (ballY! = 9) {pixels.setPixelColor (index - 1, pixels. Color (30, 0, 0)); // sab hauv qab ntawm pob xim

}

yog (ballY! = 0) {pixels.setPixelColor (index + 1, pixels. Color (30, 0, 0)); // sab saum toj ntawm pob xim

}

}

lwm tus {

index = ballY + 10 * ballX; yog (ballX! = 0) {

pixels.setPixelColor ((9 - ballY) + 10 * (ballX - 1), pixels. Color (30, 0, 0)); // sab laug ntawm pob txawm kab

}

yog (ballX! = 25) {

pixels.setPixelColor ((9 - ballY) + 10 * (ballX + 1), pixels. Color (30, 0, 0)); // sab xis ntawm pob txawm kab

}

yog (ballY! = 9) {

pixels.setPixelColor (index + 1, pixels. Color (30, 0, 0)); // sab hauv qab ntawm pob txawm tias kab

}

yog (ballY! = 0) {pixels.setPixelColor (index - 1, pixels. Color (30, 0, 0)); // sab saum toj ntawm pob txawm tias kab

}

}

pixels.setPixelColor (index, pixels. Color (255, 0, 0)); /// nruab nrab ntawm pob xim

}

void displayPaddle1 () {

rau (int i = 0; kuv <paddlewidth; kuv ++) {pixels.setPixelColor (paddle1+i, pixels. Color (0, 0, 255)));

}

}

void displayPaddle2 () {

rau (int i = 0; i <paddlewidth; i ++) {pixels.setPixelColor (NUMPIXELS - 1 - paddle2 - i, pixels. Color (0, 0, 255)));

}

}

tsis muaj nuj nqis score1 () {

resetBall (0);

}

tsis muaj nuj nqis score2 () {

resetBall (1);

}

void resetBall (int player) {

ncua (1000);

ballXab = 12

; ballYabs = 4;

ballvelX = neeg uas ua ntawv? 1: -1;

ballvelY = 1;

clearScreen ();

ncua (1000);

displayBall ();

pixels.show ();

ncua (1000);

displayPaddle1 ();

displayPaddle2 (); pixels.show (); ncua (2000); }

Kauj ruam 7: Ua tiav

Ua tiav
Ua tiav

Thaum koj tau tshaj tawm cov cai laum ib lub qhov nyob hauv lub vaj huam sib luag tom qab loj txaus rau koj lub tog raj fais fab adapter. ntsaws nws rau hauv arduino thiab thaum kawg rov qab los.

Kuv kuj suav nrog hauv cov npe ib feem ntawm LED diffuser acrylic koj tam sim no tuaj yeem tso qhov ntawd hla cov LEDs thiab lo nws

Tom qab koj tau ua tiav qhov no koj tau npaj ua si thiab txaus siab rau lub sijhawm ntawm kev sib tw ua si tiv thaiv tsev neeg thiab phooj ywg.

Thaum kawg kuv xav nrog koj zoo siab rau qhov ua tiav txoj haujlwm.

Yog tias koj muaj teeb meem hu rau kuv ntawm no thiab kuv xav pab daws qhov teeb meem.

Pom zoo: