-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtester.rb
46 lines (33 loc) · 927 Bytes
/
tester.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require './lib/dyio.rb'
include Bowler
#bt = Bowler::IO::Bluetooth::DBusBluez.new
#puts 'bt ready'
#dyio = DyIO.new(bt.tty)
dyio = DyIO.new('/dev/DyIO0')
puts 'dyio ready'
dyio.connect do
puts 'Enter servo channel: '
#servo = Bowler::IO::Peripherals::Servo.new(dyio, 9)
servo = dyio.get_channel_as_servo (gets.to_i)
#pot = Bowler::IO::Peripherals::Potentiometer.new(dyio, 13)
pot = dyio.get_channel_as_potentiometer 13
pot.async = true
# pm = proc do |frac|
# puts "I love cheese this much: #{frac*27}"
# end
pot.on_every_change do |fraction|
puts "Pot is #{fraction}"
# servo.move_to (200*fraction+20).to_i, 500
end
# dyio.handle.every_power_event do |data|
# puts "power: #{data}"
# end
# puts 'ready'
# uart = Bowler::IO::Peripherals::UART.new(dyio)
# uart.transmit([128,132,139,2,0,0]) do |d|
# end
# uart.transmit([128,142,9]) do |d|
# end
# puts uart.receive
# puts 'done!'
end