I'm currently working on a project involving two nRF24L01+ 2.4GHz transceivers. I have working Arduino codes for both transceivers (one sending and one receiving). I currently want both codes to run without the need of installing the Arduino IDE. I was thinking of using python to upload and run the code, though I'm having difficulty searching around for any information on this. Is it possible? Below I have attached my two codes. Thanks in advance for any insights!
Check the box next to "Show verbose output during > upload"
Click the "OK" button.
Upload a sketch to your Arduino board.
After the upload finishes, examine the contents of the black console pane at the bottom of the Arduino IDE window. There, you will see the command the Arduino IDE used to upload the compiled sketch to the Arduino board. You can make your Python script do the same thing.
Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.
Repeated cross-posting will result in a suspension from the forum.
In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum board. It contains a lot of other useful information. Please read it.
Check the box next to "Show verbose output during > upload"
Click the "OK" button.
Upload a sketch to your Arduino board.
After the upload finishes, examine the contents of the black console pane at the bottom of the Arduino IDE window. There, you will see the command the Arduino IDE used to upload the compiled sketch to the Arduino board. You can make your Python script do the same thing.
What do you mean by "run the code"?
Which Arduino board are you using?
I'm trying to use a python script to upload a compiled sketch so that I can take my Arduino, python script, and sketch files to a new computer that has python installed. Run the python script and be successful in uploading the code.
I believe this was a simple solution! But I do have a question stemming from this now:
If I were to go to a new computer, would I still need avrdude? Is there a workaround without using avrude?
yungb1ood:
If I were to go to a new computer, would I still need avrdude? Is there a workaround without using avrude?
You need a program that is able to communicate with the bootloader on your Arduino board to transfer the data of the compiled sketch to the microcontroller's flash memory. You could write your own program that reproduces the functionality of avrdude, but that seems like a lot of work when we already have a nice tool available.
You only mentioned uploading as your goal. Note that avrdude only transfers the binary file that the compiler produced from your sketch. If you only want to upload, you could just compile the sketch once, then save that file (the .hex file shown in the upload command if you're using an AVR board) to upload. However, if you want to be able to make modifications to your sketch. You are also going to need the compiler. This makes the project far more complex and the requirements of the tools you will need much greater. If you want to get an idea of what is required to compile a sketch, check the verbose output during compilation option in your preferences and then do a compilation.
My recommendation would be to set up an installation of Arduino CLI on a flash drive. If you like, you can use your Python script to control Arduino CLI to compile and upload the sketch to your Arduino board.
You can also use the Arduino IDE's CLI (command line interface), as demonstrated by Robin2's Python script if you prefer. If you don't need a GUI, then there is really no need for the full Arduino IDE installation on your flash drive though.