Following my research into the coding libraries and looking at the example code I decided I was going to use the code to experiment with changing the text on the LED Matrix under a conditional circumstance.
To do this my initial plan was to create if statements for if I was pressing a certain key then it would run a different script. However through research I found out that this was not compatible with the Arduino Uno as it does not have native USB hid support. Following that I decided to test this using a countdown method using the code below:
//Libraries to be included:
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
// Define hardware type, size, and output pins (from the Example code)
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CS_PIN 3
MD_Parola myCode = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// SETUP CODE - runs once
void setup() {
// put your setup code here, to run once:
myCode.begin();
myCode.displayClear();
myCode.displayText("TESTING, TESTING, TESTING!", PA_CENTER, 100, 0, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
}
// REPEATING CODE
void loop() {
// put your main code here, to run repeatedly:
//initialise the x variable to test
int x;
x == 10;
x - 1;
if(x == 5){
if (myCode.displayAnimate()) {
myCode.displayReset();
}
}
}
I had the following error message when uploading the code to the Arduino:
"avrdude: ser_open(): can't open device "\.\COM3": The system cannot find the file specified. Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions."
To solve this I ended up having to update my laptop, uninstall the Arduino on my device manager, unplug it from my laptop then plug it in again. This seemed to solve the issue, as following doing this, the code uploaded pretty quickly with no errors, however the LED matrix was not displaying anything on the screen.
Next Steps:
Following this, tomorrow I am planning on testing this again. I joined the Arduino Discord Server to ask for advice on libraries and to help problem solve any issues that I might come across as I am new to physical computing.
I asked on the server if anyone knew if there was a way to do the testing through keyboard input and was directed to this link here: GitHub - techpaul/PS2KeyAdvanced: Arduino PS2 Keyboard FULL keyboard protocol support and full keys to integer coding. I was also told I could use the serial monitor which I will also look into.
Comentários