Permalink
Browse files

mil-oss II prep

  • Loading branch information...
Kit Plummer
Kit Plummer committed Jul 31, 2010
1 parent 91b2bfb commit 65f8645fbf2ad6bfcec9f751a1cfe38dcbcb9dc6
Binary file not shown.
Binary file not shown.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,20 @@
+require 'rubygems'
+require 'phidgets4r'
+
+servo = Phidgets::Servo.new(-1, 2000)
+puts "device_id: #{servo.getDeviceID}"
+puts "device_name: #{servo.getDeviceName}"
+puts "status: #{servo.getDeviceStatus}"
+max = servo.getPositionMax(0)
+min = servo.getPositionMin(0)
+puts "min: #{min} - max: #{max}"
+servo.setPosition(0, 0.0)
+servo.setPosition(0, 0.0)
+sleep 2
+servo.setPosition(0, 220.0)
+sleep 2
+servo.setPosition(0, 100.0)
+
+position = servo.getPosition(0)
+servo.close
+servo.delete
View
@@ -0,0 +1,23 @@
+require 'rubygems'
+require 'phidgets4r'
+require 'sinatra'
+
+get '/move/:pos' do
+
+ servo = Phidgets::Servo.new(-1, 2000)
+ puts "device_id: #{servo.getDeviceID}"
+ puts "device_name: #{servo.getDeviceName}"
+ puts "status: #{servo.getDeviceStatus}"
+ max = servo.getPositionMax(0)
+ min = servo.getPositionMin(0)
+ puts "min: #{min} - max: #{max}"
+ servo.setPosition(0, 0.0)
+ servo.setPosition(0, params[:pos].to_f)
+ sleep 2
+
+
+ position = servo.getPosition(0)
+ servo.close
+ servo.delete
+ "moved to #{position}"
+end

0 comments on commit 65f8645

Please sign in to comment.