Arduino Pin Library  v4.2.0
An easy to use Arduino library for fast and simultaneous operations on Arduino I/O pins.
Pin-PWM.ino
Go to the documentation of this file.
1 
8 #include <Pin.h> // Include Pin Library
9 
10 Pin myPin = Pin(5); // Create Pin object for digital pin labelled 5 on any of the supported boards
11 
15 void setup() {
16  myPin.setOutput(); // Set Pin to output mode
17 
18  // The Pin must support PWM
19  myPin.setDutyCycle(127); // Set Pin duty cycle to 127 (~50%)
20 }
21 
25 void loop() {
26 }
Class for fast operations on Arduino I/O pins.
Definition: Pin.h:39
void setDutyCycle(int value)
Set the PWM duty cycle.
Definition: Pin.h:409
void loop()
Called continously after setup.
Definition: Pin-PWM.ino:25
void setOutput()
Set the pin mode to output.
Definition: Pin.h:355
Pin myPin
Definition: Pin-PWM.ino:10
Fast operations on Arduino I/O pins.
void setup()
Called at start.
Definition: Pin-PWM.ino:15