Recently I acquired one of the matrix led panels selling on Aliexpress or Ebay and started to print some stuff.
Came to my mind that some people, including myself, need some kind of memo to remind how bad (or good huh) they are at League of Legends.
The idea is simple,Ā connect the matrix led to a microcontroller,Ā thenĀ receive some data from a script running on the computerĀ andĀ connected to the League of Legends API.
Arduino Side
From the Arduino side, it is possible to connect the matrix like this:
After having the connections well established, it is time to code. The code used in this project is based on a library from this repository, named MD_Parola. Here is the code to use: MD_Parola/Parola_Scrolling.ino at main Ā· MajicDesigns/MD_Parola (github.com).
After running and testing, the matrix should print some like: āHello! Enter new message?ā.
PC Side
If it runs smoothly, then everything is ready.Ā Connect the Arduino to the PC through USB cable.
You canĀ open a serial sessionĀ in TeraTerm (or similar software) and this text is what you got from the Arduino. Now, write something and pressĀ enter, the matrix will show whatever you write!
If you canāt find which serial port is Arduino connected to, go toĀ Device ManagerĀ and checkĀ Ports.
OK, now you are good to code in python!
Code in Python
If you can output whatever you write in the serial port, you can now deal with the python code which gives us the ability to know how much time was spent in the last game played, and if the game was won or lost (we know but the computer doesnāt!).
Iām not a python developer nor a expert in any way, but I think python is so straightforward that everyone is able to understand quickly!
First, you need python installed, then you need to install theĀ riotwatcher:
After installing riotwatcher, install PySerial in order to control serial port:
Having a successful installation is mandatory to execute the python code we are going to use. Run python in the terminal to check if it is installed. Then create a file and import riotwatcher and serial ā this allows to check if the libraries are available to be used:
Then run:
If this test is successful you are ready to make a small changes in the final code!
Change Serial port (serial_port), API key (api_key), region (my_region) and summoners name (my_summonername).
The program will update every 30 seconds, and, although it can be changed, you can not change it much more, there are some limitations using Riot API ā 100 requests every 2 min. So, using 4 requests every 2 minutes we make sure everything works fine.
To change the text shown in the matrix led, change the data inside theĀ ser.write()Ā function, like:
If you are some expert in python you can add more exceptions to the code to make it more robust!
Hope you have as much fun as I had during this micro-project!