Sub program, sub routine, function, procedure — it seems like every programming language has a different name for ‘blocks of code.’ Well, now I need to write a block of code for the servo calibration procedure. So first I drafted the above procedure.
Then I modified the light calibration and main programs (functions, procedures, etc.) and created a servo_calibration() procedure. Here’s what part of that looks like:
// activate the servos myservo1.attach(11); myservo2.attach(10); // servos move forward myservo1.write(0); myservo2.write(180); t1 = millis(); servo_calibration1: v = analogRead(0); if (v<700){ goto servo_calibration1; } t2 = millis();
The photo shows check marks to 3 but I’m actually down to step 17. Just have to do EEPROM and I’ll be on my way to ‘field testing.’
(NOTE: this configuration initiation procedure is different than the one I came up with a couple days ago. I’ll show how it works when I get it running.)