| ||||||||||||||||
Software DevelopmentThe arduino IDE does not cater well for larger multi-file projects so my approach to reduce complexity will be:
The (current) content of the kupe directory:lrwxr-xr-x 1 cjordan staff 24 15 Nov 15:51 kupe.ino -> versions/rc_motionV3.ino drwxr-xr-x 6 cjordan staff 192 15 Nov 15:18 libraries -rw-r--r-- 1 cjordan staff 2823 15 Nov 16:27 locomotion.ino -rw-r--r-- 1 cjordan staff 1224 9 Nov 22:22 pin_definitions.h drwxr-xr-x 2 cjordan staff 64 15 Nov 15:50 temp drwxr-xr-x 6 cjordan staff 192 8 Nov 13:17 test drwxr-xr-x 5 cjordan staff 160 15 Nov 15:50 versions Examples of test files:-rw-r--r-- 1 cjordan staff 1193 6 Sep 13:44 TestKupeMotorController.ino -rw-r--r-- 1 cjordan staff 1351 20 Oct 22:34 TestLocomotion.ino -rw-r--r-- 1 cjordan staff 1991 8 Nov 15:21 TestRC.ino -rw-r--r-- 1 cjordan staff 216 27 Oct 17:01 test.txt Examples of versions files:-rw-r--r-- 1 cjordan staff 1783 9 Nov 22:24 rc_motion.ino -rw-r--r-- 1 cjordan staff 1986 15 Nov 15:19 rc_motionV2.ino -rw-r--r-- 1 cjordan staff 1943 22 Nov 10:30 rc_motionV3.ino It does cause a proliferation of headers: #include And using libraries where a simple .ino file or extra functions may seem overkill, but it hides the complexity away from the kupe directory. I may initially write a .ino file to get simple functionality but once it is bedded in, I will move it to its own library. So the code ends up looking like this:
void loop()
{
RC.checkInterrupts();
// we check to see if we need to kill motors via RC.
if (rcHelper.getBoolean(RC.readChannel(0))) {
Serial.println("Manual motors off");
robotStop();
delay(1000);
return;
}
...
Rather than:
if (getBoolean(RC.readChannel(0))) {
Serial.println("Manual motors off");
robotStop();
...
So we end up with more object creation and slightly more complex calling syntax but hopefully, this will pay dividends later when things get more complex. November 2025 | ||||||||||||||||
| ||||||||||||||||