[last updated: 2025-05-05]
Programming for Raspberry Pi
-----
Arduino programming Tips & Techniques I wish I'd known when I started:
---------------------------------------------
Software management (my recommendations to keep track of things):
- Save & Verify often As you are editing the sketch/program in the IDE, Frequently click Save then Verify. This will check that you have not made any major errors in programming. As you make more edits/changes in the program, do this often. It will make troubleshooting Much easier.
- Save Where?:
- I prefer to put all my programs, programs I created or edited from wherever, into a folder that is NOT in the Arduino file structure. The thing is, when you upgrade to a new version of Arduino IDE, anything that is in the Program Files (x86)/Arduino structure will be replaced with the new version. If you've put your personally created sketches there, you'll lose them.
- But... You can put your personal sketches into the Sketchbook folder... [more explanation later...]
- Revision Control:
- This is just the way I do it...
- When I am in the process of creating/editing a program, as recommended above, I save and test it often. Whenever I do that, assuming it works, I evaluate where I'm at in the overall editing process, and if I'm at any kind of milestone in the coding, or if the next thing I have to code is particularly difficult (eg. deep into my learning curve), then I will save-as and create a new program to continue editing.
- For example, let's say I'm creating a program to do a task, and I've started by naming the program "doTask". Now suppose I have the basics programmed, the setup and major variables defined perhaps, maybe some portion of the loop, but in any case what I have so far compiles and works. I save it with the doTask name, then I will save-as and create a new program eg. doTask-01. Then I'll continue editing the doTask-01 until I've finished some other perhaps major section, and after saving and testing, will again save-as and create an incremented program, doTask-02.
- I'm just sayin', it will happen that you'll reach some successful point, and if you don't save it there and continue editing a new program, it will happen that you'll do a lot of coding before trying to get it to compile again, and if you've done too much coding since it last worked, and now you find you've made some error and it won't compile, then troubleshooting to figure out what you did wrong can be a pain, and result in you having to start over from even before where you were at when you last had it working. I'm just sayin' ...
---------------------------------------------
There are a variety of methods to upload your sketch to your Arduino board. Not all methods work on all boards
- Here's a list of Arduino boards and the upload methods that can be used on them.
- USB - plug USB into your PC, connect to Arduino boards equipped with plugs
- Select: Tools > Board > [Uno or whatever]
- Select: Tools > Port > [generally whatever is listed, though the listing will often say "Arduino [whatever]"
- Select: Tools > Programmer > ArduinoISP
- Select: File > Upload
- If you fail to upload due to avrdude content mismatch errors, re-try. I have had eventual success sometimes after 4 or 5 tries, with no changes in between.
- FTDI:
- There are several FTDI programming boards available.
Be careful because some are selectable for either 3.3 or 5v.
I have a 5v FTDI Basic from SparkFun DEV-09716.
- AVR Programmer
- Program an Arduino from another Arduino:
---------------------------------