     midtide_last = now;
     if (midtide_direction) {
       midtide_pos++;
-      if (midtide_pos <= 135) {
-        midtide.write(midtide_pos);
+      if (midtide_pos <= 1750) {
+        midtide.writeMicroseconds(midtide_pos);
       } else {
         midtide_direction = !midtide_direction;
       }  
     }
     if (!midtide_direction) {
       midtide_pos--;
-      if (midtide_pos >= 45) {
-        midtide.write(midtide_pos);
+      if (midtide_pos >= 1250) {
+        midtide.writeMicroseconds(midtide_pos);
       } else {
         midtide_direction = !midtide_direction;
       }  


// 2 - 2.5 cycles per minute
unsigned long midtide_last = 0; 
unsigned long midtide_interval = 150; //135000; 
byte midtide_direction = 1;
byte midtide_pos = 45;

// 100 secs per cycle
unsigned long longtide_last = 0; 
unsigned long longtide_interval = 500; 
byte longtide_direction = 1;
byte longtide_pos = 45;

// 8 - 14 cycles per minute
unsigned long cri_last = 0; 
unsigned long cri_interval = 26; //600000; 
byte cri_direction = 1;
byte cri_pos = 45;
 
void setup() 
{ 

    longtide_last = now;
    if (longtide_direction) {
      longtide_pos++;
      if (longtide_pos <= 1750) {
        longtide.writeMicroseconds(longtide_pos);
      } else {
        longtide_direction = !longtide_direction;
      }  
    }
    if (!longtide_direction) {
      longtide_pos--;
      if (longtide_pos >= 1250) {
        longtide.writeMicroseconds(longtide_pos);
      } else {
        longtide_direction = !longtide_direction;
      }  
