You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As is known, in the current version of PYDAQ, to use the Arduino it is necessary to load a code onto it prior to executing PYDAQ. With this improvement, it is expected that the code loading will be done directly via Python/PYDAQ
The text was updated successfully, but these errors were encountered:
Currently, to use an Arduino with PYDAQ, you need to upload a code (sketch) onto the Arduino beforehand. This can be cumbersome, especially if you frequently change the sketch. The goal here is to automate the process of uploading the Arduino code directly from Python, making it more efficient and user-friendly.
Steps to Achieve This
Install Arduino CLI:
Set Up Your Environment:
Write a Python Function (Ensure you have Python installed and also install the subprocess module)
import subprocess
def upload_sketch(sketch_path, board_fqbn, port):
compile_command = f"arduino-cli compile --fqbn {board_fqbn} {sketch_path}"
print("compiling sketch")
subprocess.run(compile_command, shell=True, check=True)
upload_command = f"arduino-cli upload -p {port} --fqbn {board_fqbn} {sketch_path}"
print("uploading sketch")
subprocess.run(upload_command, shell=True, check=True)
print("upload successful!")
if __name__ == "__main__":
sketch_path = "path/to/your_sketch.ino"
board_fqbn = "arduino:avr:uno" # Change as per your board
port = "/dev/ttyUSB0" # Change according to your connection
upload_sketch(sketch_path, board_fqbn, port)
thanks for your comment and suggestion for improvement into PYDAQ.
At this moment I'm working on solving a different issue. In this sense, you are more than invited to implement the suggestion into PYDAQ, make tests and submit a PR.
Tell me if you want to proceed with this contribution. If so, we could be in contact by Telegram/Discord to discuss the implementation of it.
As is known, in the current version of PYDAQ, to use the Arduino it is necessary to load a code onto it prior to executing PYDAQ. With this improvement, it is expected that the code loading will be done directly via Python/PYDAQ
The text was updated successfully, but these errors were encountered: