Cov txheej txheem:
- Khoom siv
- Kauj Ruam 1: Soldering Txhua Lub Cheebtsam
- Kauj Ruam 2: Teem Txhua Yam Hauv Qhov Chaw
- Kauj ruam 3: Programing
- Kauj ruam 4: Txaus siab rau !
Video: DIY Game Console Siv Arduino: 4 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Hauv qhov kev qhia no kuv yuav qhia koj tias yuav ua li cas koj tuaj yeem tsim lub console siv Arduino nano. Yog li yog tias koj xav pom cov vis dis aus ntxaws ntxaws ntawm nws ces tshawb xyuas nws ntawm kuv tus youtube channel
Khoom siv
Yog tias koj yuav los ntawm cov kab ntawv txuas no nws yuav pab kuv muab ntau txoj haujlwm rau koj
1) ARDUINO NANO2) OLED DISPLAY3) PUSH BUTTONS4) WIRES
Kauj Ruam 1: Soldering Txhua Lub Cheebtsam
Yog li, tom qab tau txais tag nrho cov khoom koj yuav tsum tau muab tshuaj txhuam tag nrho cov khoom siv raws li qhia hauv daim duab qhia kab lus no
Kauj Ruam 2: Teem Txhua Yam Hauv Qhov Chaw
Tom qab soldering txhua yam npaj txhua yam khoom zoo li no los muab nws saib zoo
Kauj ruam 3: Programing
Yog li, thaum kawg tom qab ua raws txhua kauj ruam kom raug nws yog lub sijhawm los rub cov cai hauv qab no mus rau Arduino
#suav nrog
#include #include #include #include // #suav nrog #define OLED_RESET 4 Adafruit_SSD1306 zaub (OLED_RESET); cov int c = 261; cov int d = 294; pem int = 329; ua int f = 349; pem int g = 391; const int gS = 415; int ib = 440; cov int aS = 455; ua int b = 466; ua int cH = 523; ua int cSH = 554; ua int dH = 587; const int dSH = 622; ua int eH = 659; ua int fH = 698; ua int fSH = 740; ua int gH = 784; ua int gSH = 830; ua int aH = 880; const unsigned char PROGMEM dioda16 = {0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x3F, 0xF0, 0x3C, 0x00, 0x3C, 0x00, 0xFF, 0x00, 0x7F, 0xFF, 0x7F, 0xFF, 0xFF, 0x00, 0x3C,, 0x00, 0x3C, 0x00, 0x1F, 0xF0, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; const unsigned char PROGMEM cua daj = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFE, 0x00, 0x00, 0x00, 0x07, 0x80, 0x01, 0xE0, 0x00, 0x00, 0x0, 0x0, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x7, 0xE0, 0xE0, 0x00, 0x01, 0x01, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xD7, 0xFF, 0xFF, 0xE1, 0x00, 0x01, 0xBF, 0xFC, 0x1F, 0xFA, 0x80, 0x01, 0xBF, 0xF1, 0xCF, 0xFA, 0x80, 0x01, 0x3F, 0xC2, 0x37, 0xF7, 0x80, 0x80, 0x01, 0xEF, 0x9C, 0x01, 0xE7, 0xC0, 0x01, 0xE0, 0x70, 0x06, 0x06, 0x80, 0x01, 0xE0, 0xC0, 0x03, 0x06, 0x80, 0x01, 0xFF, 0x80, 0x01, 0xFF, 0x80, 0x01, 0xF8, 0x00, 0x00, 0x1D, 0xC0, 0x03, 0x70, 0x00, 0x80, 0x0C, 0x60, 0x05, 0xB0, 0x07, 0xF0, 0x08, 0x08, 0x90, 0x09, 0x10, 0x1F, 0xF8, 0x09, 0x00, 0x0B, 0x90, 0x1F, 0x7C, 0x03, 0xF0, 0x0F, 0xC0, 0xFC, 0x0F, 0x07, 0x90, 0x0D, 0x43, 0xC0, 0x03, 0x07, 0x07, 0x90, 0x05, 0x64, 0x00, 0x00, 0x10, 0x07, 0xFC, 0x00, 0x00, 0x00, 0x26, 0x10, 0x01, 0x80, 0x00, 0x00, 0x10, 0x20, 0x01, 0x00, 0x00, 0x00, 0x0, 0x0E, 0x40, 0x01, 0x80, 0x07, 0xF0, 0x01, 0x80, 0x80, 0x07, 0xC8, 0x00, 0x80, 0x00, 0x80, 0x0B, 0xE8, 0x00, 0x80, 0x00, 0x87, 0x97, 0xE9, 0xE0, 0x80, 0x00, 0x8, 0x87, 0xDF, 0xEF, 0xA0, 0x80, 0x00, 0x4B, 0xFF, 0xFF, 0xA0, 0x80, 0x00, 0x6B, 0xDF, 0xFB, 0xA3, 0x00, 0x00, 0x24, 0x97, 0xE8, 0x24, 0x00, 0x00, 0x1E, 0x1F, 0x1F, 0xC0, 0xx2C, 0x00, 0x00, 0x08, 0x1F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xF8, 0x00, 0x00}; teeb tsa tsis muaj dab tsi () {pinMode (3, INPUT_PULLUP); pinMode (12, INPUT_PULLUP); pinMode (11, INPUT_PULLUP); display.begin (SSD1306_SWITCHCAPVCC, 0x3C); display.display (); display.clearDisplay (); display.setTextSize (0); display.drawBitmap (6, 11, cua daj cua dub, 48, 48, 1); display.setFont (& FreeSans9pt7b); display.setTextColor (WHITE); display.setCursor (65, 14); display.println ("xWing"); display.setFont (); display.setCursor (65, 17); display.setTextSize (0); display.println ("vs"); display.setCursor (0, 0); ntab voltaza = readVcc ()/1000; display.println (voltaza);; display.setFont (& FreeSans9pt7b); display.setCursor (65, 39); display.println ("Tuag"); display.setFont (); display.setCursor (65, 42); display.println ("lub hnub qub"); display.setTextSize (0); display.setCursor (65, 55); display.println ("los ntawm VRAJ"); display.setCursor (65, 20); display.display (); display.setFont (); pib (a, 500); pib (a, 500); pib (a, 500); pib (f, 350); beep (cH, 150); pib (a, 500); pib (f, 350); beep (cH, 150); beep (a, 650); ncua (500); ncua (500); } int metx = 0; int cov = 0; int postoji = 0; int np = 8; int smjer = 0; int mus = 0; int tx = 95; int ry = 0; ua rx2 = 95; int ry2 = 0; ua rx3 = 95; int ry3 = 0; int bodovi = 0; koj brzina = 3; // ceev ntawm cov mos txwv int bkugle = 1; int najmanja = 600; int najveca = 1200; koj promjer = 10; tx4 = 95; int ry4 = 0; koj zivoti = 5; int cov = 0; int ispaljeno = 0; int cov = 1; cov centar = 95; unsigned ntev pocetno = 0; unsigned ntev odabrano = 0; unsigned ntev trenutno = 0; unsigned ntev nivovrije = 0; int poz = 30; void loop () {yog (mus == 0) {display.clearDisplay (); display.drawPixel (50, 30, 1); display.drawPixel (30, 17, 1); display.drawPixel (60, 18, 1); display.drawPixel (55, 16, 1); display.drawPixel (25, 43, 1); display.drawPixel (100, 43, 1); display.drawPixel (117, 52, 1); display.drawPixel (14, 49, 1); display.drawPixel (24, 24, 1); display.drawPixel (78, 36, 1); display.drawPixel (80, 57, 1); display.drawPixel (107, 11, 1); display.drawPixel (150, 11, 1); display.drawPixel (5, 5, 1); display.drawPixel (8, 7, 1); display.drawPixel (70, 12, 1); display.drawPixel (10, 56, 1); display.drawPixel (70, 25, 1); yog (poc == 0) {pocetno = millis (); odabrano = random (400, 1200); peb = 1; } trenutno = millis (); // nivoi if ((trenutno-nivovrije)> 50000) {nivovrije = trenutno; nuj = nuj+1; brzina = sib+1; // brizna neprijateljevog metka yog (nivo % 2 == 0) {bkugle = bkugle+1; kev cog lus = kev cog lus-1; } najmanja = najmanja-50; najveca = najveca-50; } yog ((odabrano+pocetno) 0) {display.drawCircle (rx, ry, 2, 1); rx = rx-brzina;} yog (ispaljeno> 1) {display.drawCircle (rx2, ry2, 1, 1); rx2 = rx2-brzina;} yog (ispaljeno> 2) {display.drawCircle (rx3, ry3, 4, 1); rx3 = rx3-brzina;} yog (ispaljeno> 3) {display.drawCircle (rx4, ry4, 2, 1); rx4 = rx4-brzina;} yog (digitalRead (12) == 0 && poz> = 2) {poz = poz-2;} yog (digitalRead (11) == 0 && poz128) postoji = 0; if (smjer == 0) {nep = nep+bkugle;} else {nep = nep-bkugle;} if (nep> = (64-promjer)) smjer = 1; yog (nep = nep-promjer && mety (centar-promjer) && metx = pozicija-8 && ry <= pozicija+8) yog (rx4) {rx = 95; ib = -50; suab (9, 100, 100); zivoti = zivoti-1; } yog (ry2> = pozicija-8 && ry2 <= pozicija+8) yog (rx24) {rx2 = -50; ry2 = -50; suab (9, 100, 100); zivoti = zivoti-1; } yog (ry3> = pozicija-8 && ry3 <= pozicija+8) yog (rx34) {rx3 = -50; ry3 = -50; suab (9, 100, 100); zivoti = zivoti-1; } yog (ry4> = pozicija-8 && ry4 <= pozicija+8) yog (rx44) {rx4 = 200; ry4 = -50; ispaljeno = 0; suab (9, 100, 100); zivoti = zivoti-1; } yog (rx4 <1) {ispaljeno = 0; rx4 = 200;} yog (zivoti == 0) mus = 1; } yog (mus == 1) {yog (zivoti == 0) {suab (9, 200, 300)); ncua (300); suab nrov (9, 250, 200); ncua (200); suab nrov (9, 300, 300); ncua (300); zivoti = 5; } display.clearDisplay (); display.setFont (); display.setTextSize (2); display.setTextColor (WHITE); display.setCursor (7, 10); display.println ("GAME OVER!"); display.setTextSize (1); display.setCursor (7, 30); display.println ("qhab nia:"); display.setCursor (44, 30); display.println (bodovi); display.setCursor (7, 40); display.println ("qib:"); display.setCursor (44, 40); display.println (nivo); display.setCursor (7, 50); display.println ("sijhawm (s):"); display.setCursor (60, 50); display.println (trenutno/1000); display.display (); yog (digitalRead (3) == 0) {suab (9, 280, 300); ncua (300); suab nrov (9, 250, 200); ncua (200); suab nrov (9, 370, 300); ncua (300); ponovo (); }}} void ponovo () {metx = 0; cov = 0; postoji = 0; np = 8; smjer = 0; mus = 0; rx; 95 ua. rov = 0; tx2 = 95; ry2 = 0; rx3 = 95; ry3 = 0; bodovi = 0; sib = 3; // brizna neprijateljevog metka bkugle = 1; naj npawb = 600; najveca = 1200; pwm = 12; tx4 = 95 ry4 = 0; zivoti = 5; peb = 0; ispaljeno = 0; nco = 1; pocetno = 0; odabrano = 0; trenutno = 0; nivovrije = 0; } ntev nyeemVcc () {// Nyeem 1.1V siv tawm tsam AVcc // teeb tsa siv rau Vcc thiab ntsuas rau sab hauv 1.1V siv #if txhais (_ AVR_ATmega32U4_) || txhais (_ AVR_ATmega1280_) || txhais (_ AVR_ATmega2560_) ADMUX = _BV (REFS0) | _BV (MUX4) | _BV (MUX3) | _BV (MUX2) | _BV (MUX1); #elif txhais (_AVR_ATtiny24_) || txhais (_ AVR_ATtiny44_) || txhais (_ AVR_ATtiny84_) ADMUX = _BV (MUX5) | _BV (MUX0); #elif txhais (_AVR_ATtiny25_) || txhais (_ AVR_ATtiny45_) || txhais (_ AVR_ATtiny85_) ADMUX = _BV (MUX3) | _BV (MUX2); #else ADMUX = _BV (REFS0) | _BV (MUX3) | _BV (MUX2) | _BV (MUX1); #endif ncua (2); // Tos Vref los daws ADCSRA | = _BV (ADSC); // Pib hloov dua siab tshiab thaum (bit_is_set (ADCSRA, ADSC)); // ntsuas uint8_t qis = ADCL; // yuav tsum nyeem ADCL ua ntej - nws mam li kaw ADCH uint8_t siab = ADCH; // qhib ob qho txiaj ntsig ntev = (siab << 8) | qis; tshwm sim = 1125300L / tshwm sim; // Xam Vcc (hauv mV); 1125300 = 1.1*1023*1000 rov tshwm sim; // Vcc in millivolts} void beep (int note, int duration) {// Play tone on buzzerPin tone (9, note, duration); ncua (sijhawm); noTone (9); ncua (50); }
Kauj ruam 4: Txaus siab rau !
Nrog koj zoo siab? thaum kawg koj ua nws yog tias koj nyiam nws ces sau npe rau kuv tus youtube channel
Pom zoo:
Cov Khoom Siv Teeb Meem Siv Chaw Taws Teeb Siv Arduino: 7 Kauj Ruam
Cov Khoom Siv Teeb Meem Siv Khoom Siv Hluav Taws Xob Siv Arduino: Tam sim no, Cov Tsim, Cov tsim tawm tau nyiam Arduino rau kev txhim kho sai ntawm cov qauv ntawm cov phiaj xwm. Arduino yog lub platform siv hluav taws xob qhib raws qhov yooj yim-rau-siv-kho vajtse thiab software. Arduino muaj zej zog cov neeg siv zoo heev. Hauv qhov no
DIY Handheld Game Console Siv RetroPie: 7 Cov Kauj Ruam
DIY Handheld Game Console Siv RetroPie: Saib cov vis dis aus saum toj no kom nkag siab qhov haujlwm no zoo dua. Zoo. Nws yog lub sijhawm kom pib koj! Ua ntej tshaj plaws, peb yuav siv RetroPie. Qhov no tawm peb nrog ob txoj kev xaiv. Yog tias peb twb tau teeb tsa Raspbian ntawm peb daim npav SD, tom qab ntawv peb tuaj yeem nruab RetroP
Ua Game Console Siv Koj Tus Raspberry Pi!: 6 Cov Kauj Ruam
Ua Game Console Siv Koj Tus Raspberry Pi!: Koj puas xav ua si retro games yam tsis tau them nyiaj rau cov khoom qub qub? Koj tuaj yeem ua qhov ntawd nrog Raspberry Pi. Raspberry Pi yog " credit card-sized computer " uas muaj peev xwm ua tau ntau yam txias. Muaj ntau ntau hom sib txawv
Handheld Recalbox Game Console Siv 2.2 TFT: 6 Cov Kauj Ruam
Handheld Recalbox Game Console Siv 2.2 TFT: Cov lus qhia rau DIY ntawm lub handheld recalbox game console siv 2.2 "TFT LCD thiab Raspberry Pi 0 W thiab GPIO khawm. Tau txais txhua qhov B. Siv cov khoom sib dhos ua ke
Arduino Pocket Game Console + A -Maze - Maze Game: 6 Cov Kauj Ruam (nrog Duab)
Arduino Pocket Game Console + A -Maze - Maze Game: Zoo siab txais tos rau kuv thawj qhov kev qhia! Txoj haujlwm kuv xav qhia rau koj hnub no yog Arduino tshawb nrhiav game, uas dhau los ua lub hnab ntim khoom muaj peev xwm zoo li Arduboy thiab zoo ib yam li Arduino raws cov khoom siv. Nws tuaj yeem ua rau pom nrog kuv (lossis koj) kev ua si yav tom ntej ua tsaug rau nthuav tawm