This Python script allows you to send messages from your computer to an Arduino board, which can then be displayed on an LCD screen. The script utilizes the pyFirmata
library to communicate with the Arduino via serial.
- Send messages to Arduino: Easily send any string to your Arduino board to be displayed on an attached LCD screen.
- Simple and efficient: Uses Python's
pyFirmata
library for serial communication. - Customizable: Adjust the port and message as needed for different setups and applications.
- Python 3.x
- Arduino board (e.g., Arduino Uno)
- LCD screen connected to the Arduino
- pyFirmata library
-
Install Python: Make sure you have Python 3.x installed on your system.
-
Install the
pyFirmata
library:pip install pyfirmata
-
Upload StandardFirmata to the Arduino:
- Download and install the Arduino IDE if you haven't already.
- Connect your Arduino board to your computer via USB.
- Open the Arduino IDE and go to File > Examples > Firmata > StandardFirmata.
- Select the appropriate port for your Arduino under Tools > Port.
- Choose your Arduino board model under Tools > Board.
- Click the Upload button (right arrow icon) to upload the StandardFirmata code to your Arduino.
-
Connect your Arduino: Note the port that your Arduino is connected to (e.g.,
COM3
on Windows or/dev/ttyUSB0
on Linux).
-
Clone the repository:
git clone https://github.com/Rcode879/arduino-lcd-display.git cd arduino-lcd-display
-
Run the script:
Open a terminal or command prompt, navigate to the directory, and run:
python lcd.py
-
Modify the script as needed:
- Change the port: Adjust the
COM3
value to match the port your Arduino is connected to. - Update the message: Modify the
display_message("Hello, Arduino!")
line to send a different message to the LCD.
- Change the port: Adjust the
- Initialize Connection: The script connects to the Arduino board using the
pyFirmata
library, specifying the port (e.g.,COM3
). - Send a Message: The
display_message
function sends a string to the Arduino to be displayed on the LCD screen using theSTRING_DATA
sysex message. - Keep the Script Running: A
while True
loop keeps the script active, maintaining the connection with the Arduino.
To display "Hello, Arduino!" on the LCD screen, the script uses:
display_message("Hello, Arduino!")