madrona-rad 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/examples/debounce_methods.rb +55 -44
- data/lib/examples/hello_eeprom.rb +54 -43
- data/lib/examples/i2c_with_clock_chip.rb +112 -101
- data/lib/examples/midi_scales.rb +93 -82
- data/lib/rad/init.rb +1 -1
- metadata +12 -2
@@ -1,49 +1,60 @@
|
|
1
1
|
class DebounceMethods < ArduinoSketch
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
input_pin 8, :as => :button_three, :device => :button
|
7
|
-
input_pin 9, :as => :button_four, :device => :button
|
8
|
-
input_pin 10, :as => :button_five, :device => :button
|
9
|
-
|
10
|
-
# depressing and releasing button_one, button_two or button_four do the same thing
|
11
|
-
# with a slightly different syntax and number of blinks
|
12
|
-
# button_three simply toggles the led with the read_and_toggle method
|
13
|
-
# button_five does it with a twist
|
14
|
-
|
15
|
-
def loop
|
16
|
-
blink_twice if read_input button_one
|
17
|
-
blink_three_times if read_input button_two
|
18
|
-
button_three.read_and_toggle led #
|
19
|
-
blink_three_times_basic if read_input button_four
|
20
|
-
blink_with_a_twist if read_input button_five
|
21
|
-
end
|
22
|
-
|
23
|
-
def blink_twice
|
24
|
-
2.times do |i|
|
25
|
-
led.blink 200 + i
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def blink_three_times
|
30
|
-
3.times { led.blink 200 }
|
31
|
-
end
|
3
|
+
# IMPORTANT -- This is one for four examples that fails with Ruby 1.9 support (latest ruby2c and parsetree)
|
4
|
+
# the failing example is commented out and replaced with this hello world until I have a chance to resolve the issue -- jd
|
5
|
+
output_pin 13, :as => :led
|
32
6
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
7
|
+
def loop
|
8
|
+
blink led, 100
|
9
|
+
x = 4
|
10
|
+
end
|
11
|
+
|
12
|
+
##
|
13
|
+
|
14
|
+
# output_pin 13, :as => :led
|
15
|
+
# input_pin 6, :as => :button_one, :device => :button # can also :adjust => 300
|
16
|
+
# input_pin 7, :as => :button_two, :device => :button
|
17
|
+
# input_pin 8, :as => :button_three, :device => :button
|
18
|
+
# input_pin 9, :as => :button_four, :device => :button
|
19
|
+
# input_pin 10, :as => :button_five, :device => :button
|
20
|
+
#
|
21
|
+
# # depressing and releasing button_one, button_two or button_four do the same thing
|
22
|
+
# # with a slightly different syntax and number of blinks
|
23
|
+
# # button_three simply toggles the led with the read_and_toggle method
|
24
|
+
# # button_five does it with a twist
|
25
|
+
#
|
26
|
+
# def loop
|
27
|
+
# blink_twice if read_input button_one
|
28
|
+
# blink_three_times if read_input button_two
|
29
|
+
# button_three.read_and_toggle led #
|
30
|
+
# blink_three_times_basic if read_input button_four
|
31
|
+
# blink_with_a_twist if read_input button_five
|
32
|
+
# end
|
33
|
+
#
|
34
|
+
# def blink_twice
|
35
|
+
# 2.times do |i|
|
36
|
+
# led.blink 200 + i
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
# def blink_three_times
|
41
|
+
# 3.times { led.blink 200 }
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# # no blink helper
|
45
|
+
# def blink_three_times_basic
|
46
|
+
# 4.times do
|
47
|
+
# led.digitalWrite HIGH
|
48
|
+
# delay 200
|
49
|
+
# led.digitalWrite LOW
|
50
|
+
# delay 200
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# def blink_with_a_twist
|
55
|
+
# 20.times do |i|
|
56
|
+
# led.blink i * 10
|
57
|
+
# end
|
58
|
+
# end
|
48
59
|
|
49
60
|
end
|
@@ -1,51 +1,62 @@
|
|
1
1
|
class HelloEeprom < ArduinoSketch
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# IMPORTANT -- This is one for four examples that fails with Ruby 1.9 support (latest ruby2c and parsetree)
|
4
|
+
# the failing example is commented out and replaced with this hello world until I have a chance to resolve the issue -- jd
|
5
|
+
output_pin 13, :as => :led
|
5
6
|
|
6
|
-
output_pin 14, :as => :myLCD, :device => :pa_lcd, :rate => 19200
|
7
|
-
|
8
7
|
def loop
|
9
|
-
|
10
|
-
|
11
|
-
myLCD.print "/"
|
12
|
-
myLCD.print rtc.get(4, 0) # no need to refresh (=0) get day
|
13
|
-
myLCD.print "/"
|
14
|
-
myLCD.print rtc.get(6, 0) # get year
|
15
|
-
myLCD.setxy(0,1) # set in 1 byte line 1 (second line)
|
16
|
-
printlz 2 # print hours with lead zero
|
17
|
-
myLCD.print ":"
|
18
|
-
printlz 1 # print minutes with lead zero
|
19
|
-
myLCD.print ":"
|
20
|
-
printlz 0 # print seconds with lead zero
|
21
|
-
|
22
|
-
|
23
|
-
myLCD.setxy 10,0
|
24
|
-
myLCD.print "write test"
|
25
|
-
myLCD.setxy 0,2
|
26
|
-
32.upto(109) do # write address of byte to that b yte
|
27
|
-
|x| mem0.write_byte x, x
|
28
|
-
myLCD.print(".") if x%2
|
29
|
-
delay 10
|
30
|
-
end
|
31
|
-
|
32
|
-
delay 2000
|
33
|
-
|
34
|
-
myLCD.clearline 2 # clears bottom two lines
|
35
|
-
myLCD.clearline 3
|
36
|
-
|
37
|
-
myLCD.setxy 10,0, "read test "
|
38
|
-
myLCD.setxy 0,2
|
39
|
-
# read and print 39 addresses with printable numbers
|
40
|
-
75.upto(113) { |x| myLCD.print(mem0.read_byte(x)) }
|
41
|
-
delay 10000
|
42
|
-
myLCD.clearscr
|
8
|
+
blink led, 100
|
9
|
+
x = 4
|
43
10
|
end
|
44
11
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
12
|
+
##
|
13
|
+
|
14
|
+
# output_pin 19, :as => :rtc, :device => :i2c_ds1307, :enable => :true
|
15
|
+
# output_pin 19, :as => :mem0, :device => :i2c_eeprom
|
16
|
+
#
|
17
|
+
# output_pin 14, :as => :myLCD, :device => :pa_lcd, :rate => 19200
|
18
|
+
#
|
19
|
+
# def loop
|
20
|
+
# myLCD.setxy 0,0 # set to 0,0
|
21
|
+
# myLCD.print rtc.get(5, 1) # refresh registers (=1) get month
|
22
|
+
# myLCD.print "/"
|
23
|
+
# myLCD.print rtc.get(4, 0) # no need to refresh (=0) get day
|
24
|
+
# myLCD.print "/"
|
25
|
+
# myLCD.print rtc.get(6, 0) # get year
|
26
|
+
# myLCD.setxy(0,1) # set in 1 byte line 1 (second line)
|
27
|
+
# printlz 2 # print hours with lead zero
|
28
|
+
# myLCD.print ":"
|
29
|
+
# printlz 1 # print minutes with lead zero
|
30
|
+
# myLCD.print ":"
|
31
|
+
# printlz 0 # print seconds with lead zero
|
32
|
+
#
|
33
|
+
#
|
34
|
+
# myLCD.setxy 10,0
|
35
|
+
# myLCD.print "write test"
|
36
|
+
# myLCD.setxy 0,2
|
37
|
+
# 32.upto(109) do # write address of byte to that b yte
|
38
|
+
# |x| mem0.write_byte x, x
|
39
|
+
# myLCD.print(".") if x%2
|
40
|
+
# delay 10
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
# delay 2000
|
44
|
+
#
|
45
|
+
# myLCD.clearline 2 # clears bottom two lines
|
46
|
+
# myLCD.clearline 3
|
47
|
+
#
|
48
|
+
# myLCD.setxy 10,0, "read test "
|
49
|
+
# myLCD.setxy 0,2
|
50
|
+
# # read and print 39 addresses with printable numbers
|
51
|
+
# 75.upto(113) { |x| myLCD.print(mem0.read_byte(x)) }
|
52
|
+
# delay 10000
|
53
|
+
# myLCD.clearscr
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# def printlz(w)
|
57
|
+
# i = 0 + rtc.get(w,0) # the '0 +' is YARH (Yet Another RubyToc Hack)
|
58
|
+
# myLCD.print "0" if i < 10
|
59
|
+
# myLCD.print i
|
60
|
+
# end
|
50
61
|
|
51
62
|
end
|
@@ -1,5 +1,16 @@
|
|
1
1
|
class I2cWithClockChip < ArduinoSketch
|
2
2
|
|
3
|
+
# IMPORTANT -- This is one for four examples that fails with Ruby 1.9 support (latest ruby2c and parsetree)
|
4
|
+
# the failing example is commented out and replaced with this hello world until I have a chance to resolve the issue -- jd
|
5
|
+
output_pin 13, :as => :led
|
6
|
+
|
7
|
+
def loop
|
8
|
+
blink led, 100
|
9
|
+
x = 4
|
10
|
+
end
|
11
|
+
|
12
|
+
##
|
13
|
+
|
3
14
|
# ----------------------------------------------------------------------------------
|
4
15
|
# <b>Time and Temp (20 July 2008)</b>
|
5
16
|
# Example #1 - Brian Riley, Underhill Center, VT USA <brianbr@wulden.org>
|
@@ -19,106 +30,106 @@ class I2cWithClockChip < ArduinoSketch
|
|
19
30
|
|
20
31
|
# ----------------------------------------------------------------------------------
|
21
32
|
|
22
|
-
@hi_byte = int
|
23
|
-
@lo_byte = int
|
24
|
-
@t_reading = int
|
25
|
-
@device_crc = int
|
26
|
-
@sign_bit = int
|
27
|
-
@tc_100 = int
|
28
|
-
|
29
|
-
|
30
|
-
output_pin 19, :as => :rtc, :device => :i2c_ds1307, :enable => :true
|
31
|
-
|
32
|
-
|
33
|
-
output_pin 14, :as => :myLCD, :device => :pa_lcd, :rate => 19200, :clear_screen => :true
|
34
|
-
|
35
|
-
|
36
|
-
output_pin 8, :as => :myTemp, :device => :onewire
|
37
|
-
|
38
|
-
|
39
|
-
def loop
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
end
|
108
|
-
|
109
|
-
def
|
110
|
-
|
111
|
-
|
112
|
-
end
|
113
|
-
|
114
|
-
def
|
115
|
-
|
116
|
-
|
117
|
-
end
|
118
|
-
|
119
|
-
def clear_bottom_line
|
120
|
-
|
121
|
-
|
122
|
-
end
|
33
|
+
# @hi_byte = int
|
34
|
+
# @lo_byte = int
|
35
|
+
# @t_reading = int
|
36
|
+
# @device_crc = int
|
37
|
+
# @sign_bit = int
|
38
|
+
# @tc_100 = int
|
39
|
+
# # implicit in :device => Z:ds1307 is that this i i2c
|
40
|
+
# # :enable => true issues the Wire.begin to ick over i2c
|
41
|
+
# output_pin 19, :as => :rtc, :device => :i2c_ds1307, :enable => :true
|
42
|
+
# # software serial tx drives LCD display, screen cleared at startup
|
43
|
+
# # defines the softare protocol for controller as Peter Anderson
|
44
|
+
# output_pin 14, :as => :myLCD, :device => :pa_lcd, :rate => 19200, :clear_screen => :true
|
45
|
+
# # defines this pin as being connected to a DalSemi 1-Wire device
|
46
|
+
# # no specific device drivers yet, the specific device code is on you
|
47
|
+
# output_pin 8, :as => :myTemp, :device => :onewire
|
48
|
+
#
|
49
|
+
#
|
50
|
+
# def loop
|
51
|
+
# until myTemp.reset do # reset bus, verify its clear and high
|
52
|
+
# clear_bottom_line
|
53
|
+
# myLCD.print " <1Wire Buss Error>"
|
54
|
+
# delay 2000
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# myTemp.skip # "listen up - everybody!"
|
58
|
+
# myTemp.write 0x44, 1 # temperature sensors, strta conversion
|
59
|
+
#
|
60
|
+
# myLCD.setxy 6,0 # while they do that, lets print date/time
|
61
|
+
# myLCD.print rtc.get(5, 1)
|
62
|
+
# myLCD.print "/"
|
63
|
+
# myLCD.print rtc.get(4, 0)
|
64
|
+
# myLCD.print "/"
|
65
|
+
# myLCD.print rtc.get(6, 0)
|
66
|
+
# myLCD.setxy 6,1
|
67
|
+
# printlz rtc.get(2, 0)
|
68
|
+
# myLCD.print ":"
|
69
|
+
# printlz rtc.get(1, 0)
|
70
|
+
# myLCD.print ":"
|
71
|
+
# printlz rtc.get(0, 0)
|
72
|
+
#
|
73
|
+
# delay 800 # conversion takes about 750 msecs
|
74
|
+
#
|
75
|
+
# until myTemp.reset do # reset bus, verify its clear and high
|
76
|
+
# clear_bottom_line
|
77
|
+
# myLCD.print " <1Wire Buss Error>"
|
78
|
+
# delay 2000
|
79
|
+
# end
|
80
|
+
# myTemp.skip # listen up!
|
81
|
+
# myTemp.write 0xBE, 1 # send me your data conversions
|
82
|
+
#
|
83
|
+
# @lo_byte = myTemp.read # get irst byte
|
84
|
+
# @hi_byte = myTemp.read # get second byte
|
85
|
+
#
|
86
|
+
# # -------------------------------------------------------------
|
87
|
+
# clear_bottom_line # this code is debug - not necessary
|
88
|
+
# myLCD.setxy 4,3 # raw hex display of temp value
|
89
|
+
# myLCD.print "raw = 0x"
|
90
|
+
# print_hexbyte @hi_byte # prints 2 digit hex w/lead 0
|
91
|
+
# print_hexbyte @lo_byte
|
92
|
+
# # -------------------------------------------------------------
|
93
|
+
#
|
94
|
+
# 7.times { @device_crc = myTemp.read } # get next 6 bytes, drop them on floor
|
95
|
+
# # next byte the ninth byte is the CRC
|
96
|
+
#
|
97
|
+
# # DS18B20 brings data temperature back as 12 bits
|
98
|
+
# # in degrees centigrade with 4 bits fractional, that is
|
99
|
+
# # each bit s 1/16 of a degreeC
|
100
|
+
#
|
101
|
+
# @t_reading = build_int @hi_byte, @lo_byte
|
102
|
+
# @sign_bit = bit_and @t_reading, 0x8000
|
103
|
+
# @t_reading = twos_comp @t_reading if @sign_bit # negative
|
104
|
+
#
|
105
|
+
# @tc_100 = (6 * @t_reading) + (@t_reading / 4) #multiply by (100 * 0.0625) or 6.25
|
106
|
+
#
|
107
|
+
# myLCD.setxy 2,2
|
108
|
+
# if @sign_bit
|
109
|
+
# myLCD.print "-"
|
110
|
+
# else
|
111
|
+
# myLCD.print " "
|
112
|
+
# end
|
113
|
+
# myLCD.print(@tc_100 / 100) # separate off the whole
|
114
|
+
# myLCD.print "."
|
115
|
+
# printlz(@tc_100 % 100) # and fractional portions
|
116
|
+
# myLCD.print " degrees C"
|
117
|
+
#
|
118
|
+
# end
|
119
|
+
#
|
120
|
+
# def printlz(w)
|
121
|
+
# myLCD.print "0" if w < 10
|
122
|
+
# myLCD.print w
|
123
|
+
# end
|
124
|
+
#
|
125
|
+
# def print_hexbyte(w)
|
126
|
+
# myLCD.print "0" if w < 0x10
|
127
|
+
# myLCD.print w, 0x10
|
128
|
+
# end
|
129
|
+
#
|
130
|
+
# def clear_bottom_line
|
131
|
+
# myLCD.setxy 0,3
|
132
|
+
# myLCD.print "?l"
|
133
|
+
# end
|
123
134
|
|
124
135
|
end
|
data/lib/examples/midi_scales.rb
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
class MidiScales < ArduinoSketch
|
2
2
|
|
3
|
+
# IMPORTANT -- This is one for four examples that fails with Ruby 1.9 support (latest ruby2c and parsetree)
|
4
|
+
# the failing example is commented out and replaced with this hello world until I have a chance to resolve the issue -- jd
|
5
|
+
output_pin 13, :as => :led
|
6
|
+
|
7
|
+
def loop
|
8
|
+
blink led, 100
|
9
|
+
x = 4
|
10
|
+
end
|
11
|
+
|
12
|
+
##
|
13
|
+
|
3
14
|
# purpose
|
4
15
|
# trigger midi output with buttons and
|
5
16
|
# spectra soft pots
|
@@ -7,88 +18,88 @@ class MidiScales < ArduinoSketch
|
|
7
18
|
#
|
8
19
|
|
9
20
|
|
10
|
-
@current_note = int
|
11
|
-
@last_note_one = 0
|
12
|
-
@last_note_two = 0
|
13
|
-
@last_note_three = 0
|
14
|
-
@note = int
|
15
|
-
|
16
|
-
input_pin 1, :as => :sensor_one, :device => :spectra
|
17
|
-
input_pin 2, :as => :sensor_two, :device => :spectra
|
18
|
-
input_pin 3, :as => :sensor_three, :device => :spectra
|
19
|
-
input_pin 7, :as => :button_one, :device => :button
|
20
|
-
input_pin 8, :as => :button_two, :device => :button
|
21
|
-
input_pin 9, :as => :button_three, :device => :button
|
22
|
-
output_pin 13, :as => :led
|
23
|
-
|
24
|
-
serial_begin :rate => 31250
|
25
|
-
|
26
|
-
def setup
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
def loop
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
def change_tone
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
def change_pressure
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
def change_channels
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
def read_sensor_one
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
def read_sensor_two
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
def read_sensor_three
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
def pre_play(current_note, last_note, channel) # warning, don't use last as a parameter...
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
def play(chan, note, pressure)
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
end
|
88
|
-
|
89
|
-
def play_with_no_delay(chan, note, pressure) # note is not turned off
|
90
|
-
|
91
|
-
end
|
21
|
+
# @current_note = int
|
22
|
+
# @last_note_one = 0
|
23
|
+
# @last_note_two = 0
|
24
|
+
# @last_note_three = 0
|
25
|
+
# @note = int
|
26
|
+
#
|
27
|
+
# input_pin 1, :as => :sensor_one, :device => :spectra
|
28
|
+
# input_pin 2, :as => :sensor_two, :device => :spectra
|
29
|
+
# input_pin 3, :as => :sensor_three, :device => :spectra
|
30
|
+
# input_pin 7, :as => :button_one, :device => :button
|
31
|
+
# input_pin 8, :as => :button_two, :device => :button
|
32
|
+
# input_pin 9, :as => :button_three, :device => :button
|
33
|
+
# output_pin 13, :as => :led
|
34
|
+
#
|
35
|
+
# serial_begin :rate => 31250
|
36
|
+
#
|
37
|
+
# def setup
|
38
|
+
# delay 3000
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# def loop
|
42
|
+
# change_tone if button_one.read_input
|
43
|
+
# change_pressure if button_two.read_input
|
44
|
+
# change_channels if button_three.read_input
|
45
|
+
# read_sensor_one
|
46
|
+
# read_sensor_two
|
47
|
+
# read_sensor_three
|
48
|
+
# end
|
49
|
+
#
|
50
|
+
# def change_tone
|
51
|
+
# 110.upto(127) do |note|
|
52
|
+
# play 0, note, 127
|
53
|
+
# end
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# def change_pressure
|
57
|
+
# 110.upto(127) do |pressure|
|
58
|
+
# play 0, 45, pressure
|
59
|
+
# end
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# def change_channels
|
63
|
+
# 0.upto(6) do |channel|
|
64
|
+
# play channel, 50, 100
|
65
|
+
# end
|
66
|
+
# end
|
67
|
+
#
|
68
|
+
# def read_sensor_one
|
69
|
+
# @current_note = sensor_one.soft_lock
|
70
|
+
# pre_play(@current_note, @last_note_one, 13)
|
71
|
+
# @last_note_one = @current_note
|
72
|
+
# end
|
73
|
+
#
|
74
|
+
# def read_sensor_two
|
75
|
+
# @current_note = sensor_two.soft_lock
|
76
|
+
# pre_play(@current_note, @last_note_two, 14)
|
77
|
+
# @last_note_two = @current_note
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
# def read_sensor_three
|
81
|
+
# @current_note = sensor_three.soft_lock
|
82
|
+
# pre_play(@current_note, @last_note_three, 15)
|
83
|
+
# @last_note_three = @current_note
|
84
|
+
# end
|
85
|
+
#
|
86
|
+
# def pre_play(current_note, last_note, channel) # warning, don't use last as a parameter...
|
87
|
+
# n = 1 + channel
|
88
|
+
# unless current_note == last_note
|
89
|
+
# @note = ((current_note /16) + 40)
|
90
|
+
# play_with_no_delay( channel, @note, 100 )
|
91
|
+
# end
|
92
|
+
# end
|
93
|
+
#
|
94
|
+
# def play(chan, note, pressure)
|
95
|
+
# note_on(chan, note, pressure)
|
96
|
+
# delay 100 # adjust to need
|
97
|
+
# note_off(chan, note, 0)
|
98
|
+
# end
|
99
|
+
#
|
100
|
+
# def play_with_no_delay(chan, note, pressure) # note is not turned off
|
101
|
+
# note_on(chan, note, pressure)
|
102
|
+
# end
|
92
103
|
|
93
104
|
|
94
105
|
end
|
data/lib/rad/init.rb
CHANGED
@@ -7,7 +7,7 @@ end
|
|
7
7
|
|
8
8
|
PLUGIN_C_VAR_TYPES = "int|void|unsigned|long|short|uint8_t|static|byte|char\\*|uint8_t"
|
9
9
|
|
10
|
-
gem "ParseTree", "~>3.0.4"
|
10
|
+
# gem "ParseTree", "~>3.0.4"
|
11
11
|
gem "ruby2c", "~>1.0.0.6"
|
12
12
|
|
13
13
|
%w(generators/makefile/makefile.rb rad_processor.rb rad_rewriter.rb rad_type_checker.rb variable_processing.rb arduino_sketch.rb arduino_plugin.rb hardware_library.rb tasks/rad.rb sketch_compiler.rb).each do |path|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: madrona-rad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Borenstein
|
@@ -33,6 +33,16 @@ dependencies:
|
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: 1.0.0.6
|
35
35
|
version:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: ParseTree
|
38
|
+
type: :runtime
|
39
|
+
version_requirement:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 3.0.4
|
45
|
+
version:
|
36
46
|
description: "Ruby Arduino Development: a framework for programming the Arduino physcial computing platform using Ruby"
|
37
47
|
email: jd@jdbarnhart.com
|
38
48
|
executables:
|
@@ -215,6 +225,6 @@ rubyforge_project: rad
|
|
215
225
|
rubygems_version: 1.3.5
|
216
226
|
signing_key:
|
217
227
|
specification_version: 2
|
218
|
-
summary: "RAD: Ruby Arduino Development - 0.3.
|
228
|
+
summary: "RAD: Ruby Arduino Development - 0.3.4"
|
219
229
|
test_files: []
|
220
230
|
|