Wiki source code of When Raspberry Pi pin [option] changes to [option]
Last modified by Stephan Robinig on 2021/02/19 16:50
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | (% class="box infomessage" %) | ||
2 | ((( | ||
3 | Waits until the specified Pin changes its state to the specified value and executes the script. High corresponds to the value 1 and low to the value 0. | ||
4 | |||
5 | [[image:when-raspberry-pi.png||alt="set-raspberry-pi-pin.png"]] | ||
6 | ))) | ||
7 | |||
8 | |||
9 | (% class="row" %) | ||
10 | ((( | ||
11 | (% class="col-xs-12 col-sm-6" %) | ||
12 | ((( | ||
13 | (% class="box" %) | ||
14 | ((( | ||
15 | ==== **Example** ==== | ||
16 | |||
17 | This script sets pin 16 to high (1). If the button is pressed electricity can flow and the led lights up. | ||
18 | At the same time the object in the app disappears, because pin 15 recieves electricity and therefor also is set to high (1). | ||
19 | |||
20 | **[[image:Bsp_When_Raspberry_Pi_pin_changes_to_1.png||alt="Bsp_When_Raspberry_Pi_pin_changes_to.png"]]** | ||
21 | [[image:Bsp_When_Raspberry_Pi_pin_changes_to_2.png]] | ||
22 | [[image:Bsp_When_Raspberry_Pi_pin_changes_to_3.png]] | ||
23 | ))) | ||
24 | ))) | ||
25 | |||
26 | (% class="col-xs-12 col-sm-6" %) | ||
27 | ((( | ||
28 | (% class="box" %) | ||
29 | ((( | ||
30 | ==== **Result** ==== | ||
31 | |||
32 | **[[[[image:Documentation.BrickDocumentation.BackgroundRequestBrick.WebHome@null4.png]]>>https://share.catrob.at/pocketcode/project/1ca4e28a-72d0-11eb-a92d-005056a36f47]]** | ||
33 | |||
34 | {{html clean="false"}} | ||
35 | <video width="320" height="688" autoplay loop muted> | ||
36 | <source id='mp4' src="https://wiki.catrobat.org/bin/download/Documentation/BrickDocumentation/WhenRaspiPinChangedBrick/WebHome/Gif_Wenn_Raspberry_Pi_Pin_a%CC%88ndert_sich_zu.mp4?rev=1.1" type='video/mp4' /> | ||
37 | |||
38 | {{/html}} | ||
39 | ))) | ||
40 | ))) | ||
41 | ))) |