class ServoThrottle

Public Instance Methods

loop() click to toggle source
# File lib/examples/servo_throttle.rb, line 19
def loop
  servo_refresh
  #delay 9 # comment out if using servo status, since it will add enough delay
  @sensor_position = analogRead(sensor)
  @servo_amount = (add_hysteresis(@sensor_position, 10)*0.36)
  my_servo.position @servo_amount
  servo_status
  
end
servo_status() click to toggle source
# File lib/examples/servo_throttle.rb, line 29
def servo_status
  
 my_lcd.setxy 0,0                        # line 0, col 0
         my_lcd.print "Read  Send"
         my_lcd.setxy 0,1         # line 1, col 0
         my_lcd.print @sensor_position # need method of blanking out previous reading
         my_lcd.setxy 6,1 
         my_lcd.print @servo_amount
end