Industrielle Fertigung
Industrielles Internet der Dinge | Industrielle Materialien | Gerätewartung und Reparatur | Industrielle Programmierung |
home  MfgRobots >> Industrielle Fertigung >  >> Manufacturing Technology >> Herstellungsprozess

Kreditkarten-großer Arduboy-Klon: Arduino Nano & I2C-OLED

Komponenten und Zubehör

Arduino Nano R3 1
Grafik-OLED 128×64 (I2C) 1
Summer (Buzzer) 1
Taster (Top-Aktuiert, 6 mm) 6
RGB-LED (Common Cathode) 1
Widerstand 220 Ω 3
Widerstand 10 kΩ 1

Benötigte Werkzeuge

Projektbeschreibung

Der Arduboy ist eine kreditkartengroße Spielkonsole mit vorinstalliertem 8-Bit-Spiel und einer Online-Bibliothek quelloffener Spiele. Er basiert auf ATmega32U4 und 128×64-OLED. Dieses Projekt nutzt statt dessen einen Arduino Nano und ein I2C-OLED – leichter beschaffbar und günstiger.

Bibliotheken und Code: harbaum/Arduboy2

Für 3D-Drucker-Besitzer: STL-Dateien für ein Gehäuse sind dort ebenfalls verfügbar. Stromversorgung per 3,7-V-Li-Ion-Akku (18650 o. ä.).

Getestete Spiele

Der Schaltplan ist im Originalprojekt abgebildet. Als Beispiel wird unten der ArduBreakout-Code gezeigt; weitere Spiele lassen sich von der Arduboy-Webseite laden.

Code: ArduBreakout

/* Breakout Copyright (C) 2011 Sebastian Goscik
 * Modifikationen Scott Allen 2016
 * GNU LGPL v2.1+
 */
#include <Arduboy2.h>

#define EE_FILE 2
Arduboy2 arduboy;
BeepPin1 beep;

const unsigned int FRAME_RATE = 40;
const unsigned int COLUMNS = 13;
const unsigned int ROWS = 4;

int dx = -1, dy = -1, xb, yb;
boolean released, paused = false;
byte xPaddle;
boolean isHit[ROWS][COLUMNS];
boolean bounced = false;
byte lives = 3, level = 1;
unsigned int score = 0, brickCount;
boolean pad, pad2, pad3, oldpad, oldpad2, oldpad3;
char text_buffer[16];
boolean start = false, initialDraw = false;
char initials[3];

byte leftBall, rightBall, topBall, bottomBall;
byte leftBrick, rightBrick, topBrick, bottomBrick;
byte tick;

void setup() {
  arduboy.begin();
  beep.begin();
  arduboy.setFrameRate(FRAME_RATE);
  arduboy.initRandomSeed();
}

void loop() {
  if (!(arduboy.nextFrame())) return;
  beep.timer();

  // Titelbildschirm & Highscores
  while (!start) {
    start = titleScreen();
    if (!start) start = displayHighScores(EE_FILE);
  }

  // Erstes Level zeichnen
  if (!initialDraw) {
    arduboy.clear();
    level = 1; newLevel(); score = 0; initialDraw = true;
  }

  if (lives > 0) {
    drawPaddle();
    pad = arduboy.pressed(A_BUTTON) || arduboy.pressed(B_BUTTON);
    if (pad && !oldpad && released) { oldpad2 = false; pause(); }
    oldpad = pad;
    drawBall();
    if (brickCount == ROWS * COLUMNS) { level++; newLevel(); }
  } else {
    drawGameOver();
    if (score > 0) enterHighScore(EE_FILE);
    arduboy.clear(); initialDraw = false; start = false; lives = 3; newLevel();
  }
  arduboy.display();
}

// ... (weitere Funktionen: movePaddle, moveBall, drawBall, drawPaddle,
// drawGameOver, pause, Score, newLevel, pollFireButton,
// displayHighScores, titleScreen, enterInitials, enterHighScore,
// playTone, playToneTimed – siehe Original für vollständigen Code)

3D-Druckdateien

Gehäuse-STLs im Originalprojekt als 3d_parts_ThLGvJvWga.rar.

Schaltplan

Siehe Originalprojekt (Bilddatei).

Herstellungsprozess

  1. Nahtlose Arduino–Raspberry Pi 2 I2C-Integration für IoT-Sensorprojekte
  2. Handheld-Konsole selbst bauen: Arduboy-Clone (Arduino Micro, OLED, PCB-Design)
  3. Klassisches Pong-Spiel auf Arduino UNO mit OLED-Display bauen – Schritt-für-Schritt-Tutorial
  4. Arduino Temperaturoverwachung & Echtzeituhr mit 3,2″ TFT-Display
  5. Einfachen Hindernissensor mit Arduino bauen – IR-LED & Photodiode Tutorial
  6. Interaktives Nextion HMI Projekt mit Arduino Mega und Sensoren
  7. Zwei Schrittmotoren mit Arduino Nano & Joystick steuern – Einfaches Tutorial
  8. DIY-Voltmeter mit Arduino und Nokia 5110 Display – Schritt-für-Schritt-Anleitung
  9. Echtzeit-Zelluläre Automaten auf Arduino mit 128x64 OLED-Display
  10. Isolierter Analogeingang für Arduino: Spannung/Strom galvanisch trennen