Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.
Class | Wiring |
||||
---|---|---|---|---|---|
Name | analogWrite() |
||||
Examples | import processing.serial.*; //Import the Serial i/o and the Wiring Libraries import Wiring.*; Wiring wiring; //Create a Wiring object int outpin = 29; int val = 0; void setup() { println(Wiring.list()); //print the serial devices list //inicialized the wiring object wiring = new Wiring ( this, Wiring.list()[1], 57600); } void draw() { Wiring.analogWrite(outpin, val); // sets the value of PWM pin 29 val = (val + 10) % 1023; // increment value and keep it in // the 0-1023 range. println(val); } |
||||
Description | The analogWrite() method sets the value of a PWM output pin. Possible values range from 0 to 1023. The analogWrite() command works on PWM output pins 29, 30, 31, 35, 36 and 37 only. | ||||
Syntax | Wiring.analogWrite(pin, value)
|
||||
Parameters |
|
||||
Returns | None | ||||
Usage | Application |