MatrixMiniR4 1.1.4
Matrix Mini R4 Arduino Library API Documentation
Loading...
Searching...
No Matches
MatrixMiniR4.cpp
Go to the documentation of this file.
1
15#include "MatrixMiniR4.h"
16#include "Modules/MMLower.h"
17
19
30{
31 MMLower::RESULT result = mmL.Init();
32
33 LED.begin(7);
34 Buzzer.begin(6);
35
36 while (!M1.begin());
37 while (!M2.begin());
38 while (!M3.begin());
39 while (!M4.begin());
40
41 RC1.begin();
42 RC2.begin();
43 RC3.begin();
44 RC4.begin();
45
46 OLED = Adafruit_SSD1306(128, 32, &Wire1, -1);
48 OLED.setTextColor(SSD1306_WHITE); //Default Color White
50 OLED.display();
51
52 /* CLK: D3R(11) , CMD: D2R(4) , SET: D3L(12) , DAT: D2L(5) */
53 PS2.config_gamepad(11, 4, 12, 5, false, false);
54
55 if (result != MMLower::RESULT::OK) {
56 OLED.setCursor(4, 8);
59 OLED.print(F("Init Error"));
60 OLED.display();
61 while (true) {
62 for (uint8_t i = 0; i < 3; i++) {
63 Buzzer.Tone(700, 100);
64 delay(100);
65 Buzzer.NoTone();
66 delay(100);
67 }
68 delay(3000);
69 }
70 }
71 return true;
72}
73
MMLower mmL(8, 9, 57600)
Handling the Lower MCU (STM32) communication.
MatrixMiniR4 MiniR4
The MiniR4 Main Object.
Header file for the MatrixMiniR4 system, integrating various hardware modules such as motors,...
#define MATRIXMINIR4_OLED_ADDRESS
#define WHITE
Draw 'on' pixels.
Definition MiniR4OLED.h:97
#define SSD1306_WHITE
Draw 'on' pixels.
Definition MiniR4OLED.h:102
#define SSD1306_SWITCHCAPVCC
Gen. display voltage from 3.3V.
Definition MiniR4OLED.h:131
void setTextSize(uint8_t s)
Set text 'magnification' size. Each increase in s makes 1 pixel that much bigger.
void setTextColor(uint16_t c)
Set text font color with transparant background.
Definition MiniR4_GFX.h:170
void setCursor(int16_t x, int16_t y)
Set text cursor location.
Definition MiniR4_GFX.h:156
Class that stores state and functions for interacting with SSD1306 OLED displays.
Definition MiniR4OLED.h:160
void display(void)
Push data currently in RAM to SSD1306 display.
bool begin(uint8_t switchvcc=SSD1306_SWITCHCAPVCC, uint8_t i2caddr=0, bool reset=true, bool periphBegin=true)
Allocate RAM for image buffer, initialize peripherals and pins.
void clearDisplay(void)
Clear contents of display buffer (set all pixels to off).
RESULT Init(uint32_t timeout_ms=1000)
Definition MMLower.cpp:15
Main class for the MatrixMiniR4 system.
MiniR4RC< 3 > RC3
Port RC3 RC 5V Servo.
MiniR4DC< 1 > M1
Port M1 DC 5V Motor.
MiniR4RC< 4 > RC4
Port RC4 RC 5V Servo.
PS2X PS2
MJ2 or PS2 (4p DAT CMD to D2, 2p CS CLK to D3)
MiniR4DC< 2 > M2
Port M2 DC 5V Motor.
MiniR4LED LED
Built-in RGB LED.
MiniR4RC< 2 > RC2
Port RC2 RC 5V Servo.
MiniR4DC< 4 > M4
Port M4 DC 5V Motor.
Adafruit_SSD1306 OLED
Built-in OLED.
bool begin()
Initialize the MatrixMiniR4 system and its components.
MiniR4DC< 3 > M3
Port M3 DC 5V Motor.
MiniR4RC< 1 > RC1
Port RC1 RC 5V Servo.
MiniR4BUZZER Buzzer
Built-in Buzzer.
void Tone(uint16_t frequency, uint32_t duration)
Generates a tone at the specified frequency for a given duration.
void NoTone(void)
Stops the tone on the buzzer.
void begin(uint8_t pin)
Initializes the buzzer by setting the pin number. (Built Buzzer at Uno Pin 6)
bool begin(void)
Initializes the DC motor settings.
Definition MiniR4DC.h:35
void begin(uint8_t pin)
Initializes the LED. (Built-in at Uno Pin 7)
Definition MiniR4LED.h:26
bool begin(void)
Initializes the servo with a default angle range.
Definition MiniR4RC.h:33
byte config_gamepad(uint8_t, uint8_t, uint8_t, uint8_t)
Configures the gamepad.