Last active
August 29, 2015 14:00
-
-
Save mmmries/11304839 to your computer and use it in GitHub Desktop.
Raw Ubuntu 14.04 to Working Artoo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Open the software sources and enable the multiverse + proprietary stuff | |
sudo apt-get install -y ruby1.9.1 ruby1.9.1-dev git | |
sudo gem install artoo-digispark --no-ri --no-rdoc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'artoo' | |
connection :digispark, :adaptor => :littlewire, :vendor => 0x1781, :product => 0x0c9f | |
device :board, :driver => :device_info | |
device :servo, :driver => :servo, :pin => 1 # pin must be a PWM pin | |
i = 0 | |
positions = [0,15,30,45,60,75,90,105,120,135,150,165,180] | |
work do | |
puts "Firmware name: #{board.firmware_name}" | |
puts "Firmata version: #{board.version}" | |
every(1) do | |
puts "Current position: #{servo.current_angle}" | |
puts "Moving to: #{positions[ i % positions.size ]}" | |
servo.move(positions[i % positions.size]) | |
i += 1 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment