rpi_gpio 0.1.4 → 0.1.5

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -16
  3. metadata +2 -3
  4. data/Gemfile.lock +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb3eca91931a655322781bb97858870321541c69
4
- data.tar.gz: 283cd9f48b7af7d11db72fd3d38118ebd9d12a19
3
+ metadata.gz: b07e0dfa373704b91f27dc3a1ff51872e72da142
4
+ data.tar.gz: b80c179d3b4cf44663c4ba6c0ec069c00c65e52a
5
5
  SHA512:
6
- metadata.gz: e603d6197144360f18af04c48dc3c9dcb8bc5ffc63e8050817e30d8ff4fa14728cb63b60506f879eb3f078ef5e9dfb7ee34158378c47317b3e9c6c46d9bbd2fe
7
- data.tar.gz: 7042bb0dbed8696695e63f86449d81167f2e1f1ac9ee166a10b6b6a73aa3abf308947b253926c57df66a970d5a0da891e2edc1829468827d8d33eb67b5d9dccc
6
+ metadata.gz: 5722a5a31d2e3abd129e251000842af33ab12beddabf98a2695ea1a42d80ee57e37334f92b793f2038f2ffc23d05804a6814a96f3bda02b5f2cf3d878cb82934
7
+ data.tar.gz: b0ed8411d9a3965d2649fc4a0eec2db4230293da60a0e70f45f2312995cae04ba7ff765bf20a7800567725e02776cabf546ee01782db483037f12f7c9371896a
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- #rpi_gpio v0.1.4
1
+ #rpi_gpio v0.1.5
2
2
 
3
3
  Ruby conversion of [RPi.GPIO Python module](https://pypi.python.org/pypi/RPi.GPIO)
4
4
 
@@ -15,7 +15,7 @@ I aimed to make the gem's usage exactly the same as its Python counterpart -- on
15
15
  ####Download the gem
16
16
 
17
17
  The easiest way to download the gem is to use [Bundler](http://bundler.io/) with a Gemfile. In your Gemfile, include the line
18
- ```
18
+ ```ruby
19
19
  gem 'rpi_gpio'
20
20
  ```
21
21
  Then you can run `bundle install` to automatically download and compile the gem for your system. To include the gem in a Ruby file, use the line `require 'rpi_gpio'`.
@@ -23,7 +23,7 @@ Then you can run `bundle install` to automatically download and compile the gem
23
23
  ####Pin numbering
24
24
 
25
25
  Before you can do anything with the GPIO pins, you need to specify how you want to number them.
26
- ```
26
+ ```ruby
27
27
  RPi::GPIO.set_numbering :board
28
28
  # or
29
29
  RPi::GPIO.set_numbering :bcm
@@ -33,20 +33,20 @@ RPi::GPIO.set_numbering :bcm
33
33
  ####Input
34
34
 
35
35
  To receive input from a GPIO pin, you must first initialize it as an input pin:
36
- ```
36
+ ```ruby
37
37
  RPi::GPIO.setup PIN_NUM, as: :input
38
38
  ```
39
39
  The pin number will differ based on your selected numbering system and which pin you want to use.
40
40
 
41
41
  Now you can use the calls
42
- ```
42
+ ```ruby
43
43
  RPi::GPIO.high? PIN_NUM
44
44
  RPi::GPIO.low? PIN_NUM
45
45
  ```
46
46
  to receive either `true` or `false`.
47
47
 
48
48
  You can use the additional hash argument `:pull` to apply a pull-up or pull-down resistor to the input pin like so:
49
- ```
49
+ ```ruby
50
50
  RPi::GPIO.setup PIN_NUM, as: :input, pull: :down
51
51
  # or
52
52
  RPi::GPIO.setup PIN_NUM, as: :input, pull: :up
@@ -57,11 +57,11 @@ RPi::GPIO.setup PIN_NUM, as: :input, pull: :off
57
57
  ####Output
58
58
 
59
59
  To send output to a GPIO pin, you must first initialize it as an output pin:
60
- ```
60
+ ```ruby
61
61
  RPi::GPIO.setup PIN_NUM, as: :output
62
62
  ```
63
63
  Now you can use the calls
64
- ```
64
+ ```ruby
65
65
  RPi::GPIO.set_high PIN_NUM
66
66
  RPi::GPIO.set_low PIN_NUM
67
67
  ```
@@ -70,45 +70,45 @@ to set the pin either high or low.
70
70
  ####PWM (pulse-width modulation)
71
71
 
72
72
  Pulse-width modulation is a useful tool for controlling things like LED brightness or motor speed. To utilize PWM, first create a PWM object for an output pin.
73
- ```
73
+ ```ruby
74
74
  pwm = RPi::GPIO::PWM.new(PIN_NUM, PWM_FREQ)
75
75
  ```
76
76
  The `PWM_FREQ` is a value in hertz that specifies the amount of pulse cycles per second.
77
77
 
78
78
  Now you can call the following method to start PWM:
79
- ```
79
+ ```ruby
80
80
  pwm.start DUTY_CYCLE
81
81
  ```
82
82
  `DUTY_CYCLE` is a value from `0.0` to `100.0` indicating the percent of the time that the signal will be high.
83
83
 
84
84
  Once running, you can get/set the PWM duty cycle with
85
- ```
85
+ ```ruby
86
86
  pwm.duty_cycle # get
87
87
  pwm.duty_cycle = NEW_DUTY_CYCLE # set
88
88
  ```
89
89
  get/set the PWM frequency with
90
- ```
90
+ ```ruby
91
91
  pwm.frequency # get
92
92
  pwm.frequency = NEW_FREQUENCY # set
93
93
  ```
94
94
  and get the PWM GPIO pin with
95
- ```
95
+ ```ruby
96
96
  pwm.pin
97
97
  ```
98
98
 
99
99
  To stop PWM, use
100
- ```
100
+ ```ruby
101
101
  pwm.stop
102
102
  ```
103
103
 
104
104
  ####Cleaning up
105
105
 
106
106
  After your program is finished using the GPIO pins, it's a good idea to release them so other programs can use them later. Simply call
107
- ```
107
+ ```ruby
108
108
  RPi::GPIO.clean_up PIN_NUM
109
109
  ```
110
110
  to release a specific pin, or
111
- ```
111
+ ```ruby
112
112
  RPi::GPIO.clean_up
113
113
  ```
114
114
  to release all allocated pins.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpi_gpio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Lowery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-09 00:00:00.000000000 Z
11
+ date: 2015-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -32,7 +32,6 @@ extensions:
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - Gemfile
35
- - Gemfile.lock
36
35
  - LICENSE
37
36
  - README.md
38
37
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,18 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- rpi_gpio (0.1.4)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- rake (10.4.2)
10
- rake-compiler (0.9.5)
11
- rake
12
-
13
- PLATFORMS
14
- ruby
15
-
16
- DEPENDENCIES
17
- rake-compiler
18
- rpi_gpio!