Hardware Reference
In-Depth Information
By default, analogRead() will return values from 0 to 1023. If you call analogR
eadResolution(12) , then analogRead() will return values of 0 to 4095. Both
ranges represent the same voltage ranges on the analog input pins.
Syntax
analogReadResolution(bits);
Parameters
bits
The resolution that analogRead() will return in bits. The default is 10 and
the maximum on Galileo is 12.
Return Value
None
Example
analogReadResolution(12);
Sets the analog-to-digital converter on Galileo to its maximum resolution, so
that analogRead() will return a value between 0 and 4095 to represent 0 to
5 volts.
analogWrite
This sets the duty cycle of a pin capable of pulse width modulation. In other
words, it will pulse the pin really quickly and allow you to adjust the amount
of time it's turned on versus turned off. On the Galileo, only pins 3, 5, 6, 9, 10,
and 11 can be used with analogWrite() . These pins are marked with a tilde
(~) on the board. See “analogWrite()” on page 43 .
Syntax
analogWrite(pin, value);
Parameters
pin
The pin number
value
An integer between 0 (totally off) and 255 (totally on)
Return value
None
Example
analogWrite(9, 127);
Search WWH ::




Custom Search