mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
First Working Display
First working LED Display - Clock is functional.
This commit is contained in:
48
README.md
48
README.md
@@ -15,19 +15,33 @@ A simple, modular clock application for Raspberry Pi using Adafruit LED Matrix d
|
|||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y python3-pip python3-dev python3-setuptools
|
sudo apt-get install -y python3-pip python3-dev python3-setuptools
|
||||||
sudo apt-get install -y build-essential git
|
sudo apt-get install -y build-essential git
|
||||||
|
sudo apt-get install -y python3-pil python3-pil.imagetk
|
||||||
|
sudo apt-get install -y cython3
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Install the rpi-rgb-led-matrix library:
|
2. Install the rpi-rgb-led-matrix library and Python bindings:
|
||||||
```bash
|
```bash
|
||||||
cd rpi-rgb-led-matrix-master
|
# Make sure you're in the main project directory
|
||||||
|
cd ~/LEDSportsMatrix/rpi-rgb-led-matrix-master
|
||||||
|
|
||||||
|
# Build the C++ library first
|
||||||
make
|
make
|
||||||
sudo make install
|
|
||||||
|
# Build and install Python bindings
|
||||||
|
cd bindings/python
|
||||||
|
sudo python3 setup.py install
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
# Install the library files
|
||||||
|
sudo cp -r lib/* /usr/local/lib/
|
||||||
|
sudo cp -r include/* /usr/local/include/
|
||||||
|
sudo ldconfig
|
||||||
cd ..
|
cd ..
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Install Python dependencies:
|
3. Install additional Python packages:
|
||||||
```bash
|
```bash
|
||||||
python3 -m pip install -r requirements.txt
|
sudo python3 -m pip install pytz
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Install the DejaVu Sans font:
|
4. Install the DejaVu Sans font:
|
||||||
@@ -35,6 +49,26 @@ python3 -m pip install -r requirements.txt
|
|||||||
sudo apt-get install -y fonts-dejavu
|
sudo apt-get install -y fonts-dejavu
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Performance Optimization
|
||||||
|
|
||||||
|
To reduce flickering and improve display quality, you have two options:
|
||||||
|
|
||||||
|
1. Run the program with root privileges (quick solution):
|
||||||
|
```bash
|
||||||
|
sudo python3 clock.py
|
||||||
|
```
|
||||||
|
|
||||||
|
2. For better performance (recommended):
|
||||||
|
- Edit `/boot/firmware/cmdline.txt`:
|
||||||
|
```bash
|
||||||
|
sudo nano /boot/firmware/cmdline.txt
|
||||||
|
```
|
||||||
|
- Add `isolcpus=3` at the end of the line
|
||||||
|
- Save and reboot:
|
||||||
|
```bash
|
||||||
|
sudo reboot
|
||||||
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Edit the `config/config.json` file to customize:
|
Edit the `config/config.json` file to customize:
|
||||||
@@ -44,10 +78,10 @@ Edit the `config/config.json` file to customize:
|
|||||||
|
|
||||||
## Running the Clock
|
## Running the Clock
|
||||||
|
|
||||||
To start the clock:
|
To start the clock with optimal performance:
|
||||||
```bash
|
```bash
|
||||||
cd src
|
cd src
|
||||||
python3 clock.py
|
sudo python3 clock.py
|
||||||
```
|
```
|
||||||
|
|
||||||
To stop the clock, press Ctrl+C.
|
To stop the clock, press Ctrl+C.
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Clock:
|
|||||||
while True:
|
while True:
|
||||||
current_time = self.get_current_time()
|
current_time = self.get_current_time()
|
||||||
# Center the text on the display
|
# Center the text on the display
|
||||||
text_width = self.display_manager.font.getsize(current_time)[0]
|
text_width = self.display_manager.font.getlength(current_time)
|
||||||
x = (self.display_manager.matrix.width - text_width) // 2
|
x = (self.display_manager.matrix.width - text_width) // 2
|
||||||
y = (self.display_manager.matrix.height - 24) // 2
|
y = (self.display_manager.matrix.height - 24) // 2
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user