File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ Portenta Breakout - analogWrite
3
+
4
+ The sketch shows how to use analogWrite API of the Portenta Breakout.
5
+
6
+ The circuit:
7
+ - Portenta H7
8
+ - Portenta Breakout
9
+
10
+ This example code is in the public domain.
11
+ */
12
+ #include " Arduino_PortentaBreakout.h"
13
+
14
+ void setup () {
15
+ Serial.begin (9600 );
16
+ while (!Serial);
17
+
18
+ // Default write resolution is 8bits
19
+ Breakout.analogWriteResolution (8 );
20
+
21
+ // PWM0 and PWM3 are using HRTIM peripheral and minimum frequency is 760Hz
22
+ Breakout.analogWrite (PWM0, 25 );
23
+ Breakout.analogWrite (PWM1, 50 );
24
+ Breakout.analogWrite (PWM2, 75 );
25
+ Breakout.analogWrite (PWM3, 100 );
26
+ // PWM4 and PWM8 are sharing the same timer channel therefore is not possible
27
+ // to use both outputs at the same time
28
+ Breakout.analogWrite (PWM4, 125 );
29
+ Breakout.analogWrite (PWM5, 150 );
30
+ Breakout.analogWrite (PWM6, 175 );
31
+ Breakout.analogWrite (PWM7, 200 );
32
+ // Breakout.analogWrite(PWM8, 225);
33
+ Breakout.analogWrite (PWM9, 250 );
34
+ }
35
+
36
+ void loop () {
37
+ delay (100 );
38
+ }
You can’t perform that action at this time.
0 commit comments