pigpio 0.1.9 → 0.1.10

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.
@@ -1,27 +0,0 @@
1
- require "pigpio"
2
- include Pigpio::Constant
3
- pi=Pigpio.new()
4
- unless pi.connect
5
- exit -1
6
- end
7
- counter=0
8
- led=pi.gpio(4)
9
- led.mode=PI_OUTPUT
10
- led.pud=PI_PUD_OFF
11
-
12
- button=pi.gpio(17)
13
- button.mode=PI_INPUT
14
- button.pud=PI_PUD_UP
15
- button.glitch_filter(30)
16
- cb=button.callback(EITHER_EDGE){|tick,level|
17
- led.write level
18
- counter+=1
19
- }
20
-
21
- led.write 1
22
- while(counter<10)do
23
- sleep(1)
24
- end
25
- cb.cancel
26
- led.write 0
27
- pi.stop
@@ -1,18 +0,0 @@
1
- require "pigpio"
2
- include Pigpio::Constant
3
-
4
- pi=Pigpio.new
5
- unless pi.connect
6
- exit -1
7
- end
8
-
9
- led = pi.gpio(4)
10
- led.mode = PI_OUTPUT
11
- led.pud = PI_PUD_OFF
12
- 3.times do |i|
13
- led.write 1
14
- sleep 1
15
- led.write 0
16
- sleep 1
17
- end
18
- pi.stop
@@ -1,22 +0,0 @@
1
- require "pigpio"
2
- include Pigpio::Constant
3
- pi=Pigpio.new()
4
- unless pi.connect
5
- exit -1
6
- end
7
- pin=pi.gpio(4)
8
- pin.mode=PI_OUTPUT
9
- pin.pud=PI_PUD_OFF
10
- pwm=pin.pwm
11
-
12
- button=pi.gpio(17)
13
- button.mode=PI_INPUT
14
- button.pud=PI_PUD_UP
15
-
16
- i=128
17
- while true do
18
- i=(i+1)%256 if button.read == 0
19
- pwm.dutycycle= i
20
- sleep 0.01
21
- end
22
- pi.stop
@@ -1,49 +0,0 @@
1
- # Simple IO sample
2
-
3
- ## Board
4
-
5
- ![board_image](./board.svg)
6
-
7
- ## GPIO sample
8
-
9
- [Script is here.](./led.rb)
10
-
11
- LED will light 3 times.
12
-
13
- ```sh
14
- $ sudo pigpiod
15
- $ ruby led.rb
16
- ```
17
-
18
- ## PWM sample
19
-
20
- [Script is here.](./pwm.rb)
21
-
22
- LED brightness will increase while you press the button.
23
-
24
- ```sh
25
- $ sudo pigpiod
26
- $ ruby pwm.rb
27
- ```
28
-
29
- ## Callback sample
30
-
31
- [Script is here.](./callback.rb)
32
-
33
- LED will light, while you release the button.
34
-
35
- ```sh
36
- $ sudo pigpiod
37
- $ ruby callback.rb
38
- ```
39
-
40
- ## WAVE sample
41
-
42
- [Script is here.](./wave.rb)
43
-
44
- LED will light 3 times.
45
-
46
- ```sh
47
- $ sudo pigpiod
48
- $ ruby wave.rb
49
- ```
@@ -1,24 +0,0 @@
1
- require "pigpio"
2
- include Pigpio::Constant
3
- pi=Pigpio.new()
4
- unless pi.connect
5
- exit -1
6
- end
7
-
8
- led=pi.gpio(4)
9
- led.mode=PI_OUTPUT
10
- led.pud=PI_PUD_OFF
11
-
12
- wave=pi.wave
13
- wave.add_new
14
- wave.add_generic([
15
- wave.pulse(0x10,0x00,1000000),
16
- wave.pulse(0x00,0x10,1000000),
17
- ])
18
- wid=wave.create
19
- wave.chain([255,0,wid,255,1,3,0])
20
- while wave.tx_busy
21
- sleep 0.1
22
- end
23
- wave.clear
24
- pi.stop