Wiki source code of Set Raspberry Pi PWM pin [value] to [value] % [value] Hz
Last modified by admin on 2023/11/27 20:22
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | (% class="box infomessage" %) | ||
2 | ((( | ||
3 | Sets the specified Pin to the specified PWM duty cycle and frequency. More information on PWM can be found [[here>>https://www.arduino.cc/en/Tutorial/Foundations/PWM]]. | ||
4 | |||
5 | [[image:set-raspberry-pi-pin-PWM.png]] | ||
6 | ))) | ||
7 | |||
8 | (% class="row" %) | ||
9 | ((( | ||
10 | (% class="col-xs-12 col-sm-6" %) | ||
11 | ((( | ||
12 | (% class="box" %) | ||
13 | ((( | ||
14 | ==== **Example** ==== | ||
15 | |||
16 | This script makes the LED pulsate by cycling the PWM value of the pin between 0 and 100. | ||
17 | |||
18 | **[[image:Bsp_PWM_Rpi_en.png||alt="Bsp_Wenn_Raspberry_Pi_Pin_Ă„ndert_sich_zu.png"]]** | ||
19 | ))) | ||
20 | ))) | ||
21 | |||
22 | (% class="col-xs-12 col-sm-6" %) | ||
23 | ((( | ||
24 | (% class="box" %) | ||
25 | ((( | ||
26 | ==== **Result** ==== | ||
27 | |||
28 | **[[[[image:Documentation.BrickDocumentation.AddItemToUserListBrick.WebHome@null4.png]]>>https://share.catrob.at/pocketcode/project/f53f19c9-74f4-11eb-a92d-005056a36f47]]** | ||
29 | |||
30 | {{html clean="false"}} | ||
31 | <video width="320" height="688" autoplay loop muted> | ||
32 | <source id='mp4' src="https://wiki.catrobat.org/bin/download/Documentation/BrickDocumentation/RaspiPwmBrick/WebHome/GIF_PWM.mp4?rev=1.1" type='video/mp4' /> | ||
33 | |||
34 | {{/html}} | ||
35 | ))) | ||
36 | ))) | ||
37 | ))) |