Programming the servo calibration procedure

DSCN9249

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.)

Advertisements

About engineerzero

Once and future engineer.
This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s