madrona-rad 0.3.9 → 0.4.0
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/Manifest.txt +1 -0
 - data/lib/examples/hello_maxbotix.rb +23 -0
 - data/lib/plugins/basics.rb +25 -15
 - data/lib/plugins/parallax_ping.rb +3 -23
 - metadata +6 -4
 
    
        data/Manifest.txt
    CHANGED
    
    | 
         @@ -24,6 +24,7 @@ lib/examples/hello_eeprom.rb 
     | 
|
| 
       24 
24 
     | 
    
         
             
            lib/examples/hello_eeprom_lcdpa.rb
         
     | 
| 
       25 
25 
     | 
    
         
             
            lib/examples/hello_format_print.rb
         
     | 
| 
       26 
26 
     | 
    
         
             
            lib/examples/hello_lcd_charset.rb
         
     | 
| 
      
 27 
     | 
    
         
            +
            lib/examples/hello_maxbotix.rb
         
     | 
| 
       27 
28 
     | 
    
         
             
            lib/examples/hello_pa_lcd.rb
         
     | 
| 
       28 
29 
     | 
    
         
             
            lib/examples/hello_servos.rb
         
     | 
| 
       29 
30 
     | 
    
         
             
            lib/examples/hello_spectra_sound.rb
         
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class HelloMaxbotix < ArduinoSketch
         
     | 
| 
      
 2 
     | 
    
         
            +
              
         
     | 
| 
      
 3 
     | 
    
         
            +
              # demonstrate maxbotix ultrasonic range finder
         
     | 
| 
      
 4 
     | 
    
         
            +
              # http://www.sparkfun.com/commerce/product_info.php?products_id=8502
         
     | 
| 
      
 5 
     | 
    
         
            +
              # 
         
     | 
| 
      
 6 
     | 
    
         
            +
              # what it does:
         
     | 
| 
      
 7 
     | 
    
         
            +
              # the closer an object comes to the maxbotix sensor, the faster the led blinks
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              # change your pins to suit your setup
         
     | 
| 
      
 10 
     | 
    
         
            +
              
         
     | 
| 
      
 11 
     | 
    
         
            +
              serial_begin :rate => 19200
         
     | 
| 
      
 12 
     | 
    
         
            +
              
         
     | 
| 
      
 13 
     | 
    
         
            +
              output_pin 5, :as => :led
         
     | 
| 
      
 14 
     | 
    
         
            +
              @max_botix_pin = 0      
         
     | 
| 
      
 15 
     | 
    
         
            +
                  
         
     | 
| 
      
 16 
     | 
    
         
            +
              def loop
         
     | 
| 
      
 17 
     | 
    
         
            +
                led.on
         
     | 
| 
      
 18 
     | 
    
         
            +
                delay(ping(@max_botix_pin)*4) 
         
     | 
| 
      
 19 
     | 
    
         
            +
                led.off
         
     | 
| 
      
 20 
     | 
    
         
            +
                delay(ping(@max_botix_pin)*4) 
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
                
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/plugins/basics.rb
    CHANGED
    
    | 
         @@ -25,30 +25,40 @@ class Basics < ArduinoPlugin 
     | 
|
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
              # call pulse(us) to pulse a servo 
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
            #####################
         
     | 
| 
      
 28 
     | 
    
         
            +
              #####################
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
            ## basics.rb contains a set of simple methods such as on an off, enabling things like
         
     | 
| 
       31 
     | 
    
         
            -
            # button.on or button.off
         
     | 
| 
      
 30 
     | 
    
         
            +
              ## basics.rb contains a set of simple methods such as on an off, enabling things like
         
     | 
| 
      
 31 
     | 
    
         
            +
              # button.on or button.off
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
            ## abstract summary:
         
     | 
| 
      
 33 
     | 
    
         
            +
              ## abstract summary:
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
               
     | 
| 
      
 35 
     | 
    
         
            +
              ## regarding analog_on:
         
     | 
| 
      
 36 
     | 
    
         
            +
              ## On newer Arduino boards (including the Mini and BT) with the ATmega168 chip, this function works on pins 3, 5, 6, 9, 10, and 11. Older USB and serial Arduino boards with an ATmega8 only support analogWrite() on pins 9, 10, and 11.
         
     | 
| 
       36 
37 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
      
 38 
     | 
    
         
            +
                # 
         
     | 
| 
       38 
39 
     | 
    
         | 
| 
      
 40 
     | 
    
         
            +
              ######################
         
     | 
| 
       39 
41 
     | 
    
         | 
| 
       40 
42 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
            void on(int pin)
         
     | 
| 
       42 
     | 
    
         
            -
            {
         
     | 
| 
       43 
     | 
    
         
            -
              digitalWrite( pin, HIGH );
         
     | 
| 
       44 
     | 
    
         
            -
            }
         
     | 
| 
       45 
43 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
            void  
     | 
| 
       47 
     | 
    
         
            -
            {
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
            }
         
     | 
| 
      
 44 
     | 
    
         
            +
              void on(int pin)
         
     | 
| 
      
 45 
     | 
    
         
            +
              {
         
     | 
| 
      
 46 
     | 
    
         
            +
                digitalWrite( pin, HIGH );
         
     | 
| 
      
 47 
     | 
    
         
            +
              }
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
              void analog_on(int pin, int val)
         
     | 
| 
      
 51 
     | 
    
         
            +
              {
         
     | 
| 
      
 52 
     | 
    
         
            +
                analogWrite( pin, val );
         
     | 
| 
      
 53 
     | 
    
         
            +
              }
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
              void off(int pin)
         
     | 
| 
      
 57 
     | 
    
         
            +
              {
         
     | 
| 
      
 58 
     | 
    
         
            +
              	digitalWrite( pin, LOW );
         
     | 
| 
      
 59 
     | 
    
         
            +
              }
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
       50 
61 
     | 
    
         | 
| 
       51 
62 
     | 
    
         | 
| 
       52 
63 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
                
         
     | 
| 
       54 
64 
     | 
    
         
             
            end
         
     | 
| 
         @@ -19,32 +19,12 @@ class ParallaxPing < ArduinoPlugin 
     | 
|
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
              # Methods for the Parallax Ping)) UltraSonic Distance Sensor.
         
     | 
| 
       21 
21 
     | 
    
         
             
              # 
         
     | 
| 
       22 
     | 
    
         
            -
              #  
     | 
| 
       23 
     | 
    
         
            -
              #
         
     | 
| 
       24 
     | 
    
         
            -
              # class RangeFinder < ArduinoSketch
         
     | 
| 
       25 
     | 
    
         
            -
              #   serial_begin
         
     | 
| 
       26 
     | 
    
         
            -
              #   
         
     | 
| 
       27 
     | 
    
         
            -
              #   external_vars :sig_pin => 'int, 7'
         
     | 
| 
       28 
     | 
    
         
            -
              #   
         
     | 
| 
       29 
     | 
    
         
            -
              #   def loop
         
     | 
| 
       30 
     | 
    
         
            -
              #     serial_println(ping(sig_pin)) 
         
     | 
| 
       31 
     | 
    
         
            -
              #     delay(200) 
         
     | 
| 
       32 
     | 
    
         
            -
              #   end
         
     | 
| 
       33 
     | 
    
         
            -
              # end
         
     | 
| 
      
 22 
     | 
    
         
            +
              # refer to the hello_maxbotix example in /examples/hello_maxbotix.rb
         
     | 
| 
       34 
23 
     | 
    
         | 
| 
       35 
24 
     | 
    
         
             
              # Triggers a pulse and returns the delay in microseconds for the echo.
         
     | 
| 
      
 25 
     | 
    
         
            +
              
         
     | 
| 
       36 
26 
     | 
    
         
             
              int ping(int pin) {
         
     | 
| 
       37 
     | 
    
         
            -
                 
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                digitalWrite(pin, LOW);
         
     | 
| 
       40 
     | 
    
         
            -
                delayMicroseconds(2);
         
     | 
| 
       41 
     | 
    
         
            -
                digitalWrite(pin, HIGH);
         
     | 
| 
       42 
     | 
    
         
            -
                delayMicroseconds(5);
         
     | 
| 
       43 
     | 
    
         
            -
                digitalWrite(pin, LOW);
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                pinMode(pin, INPUT);
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                return pulseIn(pin, HIGH);
         
     | 
| 
      
 27 
     | 
    
         
            +
                return analogRead(pin);
         
     | 
| 
       48 
28 
     | 
    
         
             
              }
         
     | 
| 
       49 
29 
     | 
    
         | 
| 
       50 
30 
     | 
    
         
             
            end
         
     | 
    
        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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Greg Borenstein
         
     | 
| 
         @@ -10,7 +10,7 @@ autorequire: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            date: 2008-09- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2008-09-04 00:00:00 -07:00
         
     | 
| 
       14 
14 
     | 
    
         
             
            default_executable: rad
         
     | 
| 
       15 
15 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       16 
16 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -85,6 +85,7 @@ files: 
     | 
|
| 
       85 
85 
     | 
    
         
             
            - lib/examples/hello_eeprom_lcdpa.rb
         
     | 
| 
       86 
86 
     | 
    
         
             
            - lib/examples/hello_format_print.rb
         
     | 
| 
       87 
87 
     | 
    
         
             
            - lib/examples/hello_lcd_charset.rb
         
     | 
| 
      
 88 
     | 
    
         
            +
            - lib/examples/hello_maxbotix.rb
         
     | 
| 
       88 
89 
     | 
    
         
             
            - lib/examples/hello_pa_lcd.rb
         
     | 
| 
       89 
90 
     | 
    
         
             
            - lib/examples/hello_servos.rb
         
     | 
| 
       90 
91 
     | 
    
         
             
            - lib/examples/hello_spectra_sound.rb
         
     | 
| 
         @@ -204,6 +205,7 @@ files: 
     | 
|
| 
       204 
205 
     | 
    
         
             
            - website/examples/serial_motor.rb.html
         
     | 
| 
       205 
206 
     | 
    
         
             
            has_rdoc: true
         
     | 
| 
       206 
207 
     | 
    
         
             
            homepage: http://github.com/atduskreg/rad
         
     | 
| 
      
 208 
     | 
    
         
            +
            licenses: 
         
     | 
| 
       207 
209 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       208 
210 
     | 
    
         
             
            rdoc_options: 
         
     | 
| 
       209 
211 
     | 
    
         
             
            - --main
         
     | 
| 
         @@ -225,9 +227,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       225 
227 
     | 
    
         
             
            requirements: []
         
     | 
| 
       226 
228 
     | 
    
         | 
| 
       227 
229 
     | 
    
         
             
            rubyforge_project: rad
         
     | 
| 
       228 
     | 
    
         
            -
            rubygems_version: 1. 
     | 
| 
      
 230 
     | 
    
         
            +
            rubygems_version: 1.3.5
         
     | 
| 
       229 
231 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       230 
232 
     | 
    
         
             
            specification_version: 2
         
     | 
| 
       231 
     | 
    
         
            -
            summary: "RAD: Ruby Arduino Development - 0. 
     | 
| 
      
 233 
     | 
    
         
            +
            summary: "RAD: Ruby Arduino Development - 0.4.0 -- 1.9 Ready!"
         
     | 
| 
       232 
234 
     | 
    
         
             
            test_files: []
         
     | 
| 
       233 
235 
     | 
    
         |