Description
Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to analogWrite(), the pin will generate a steady rectangular wave of the specified duty cycle until the next call to analogWrite() (or a call to digitalRead() or digitalWrite()) on the same pin.
You do not need to call pinMode() to set the pin as an output before calling analogWrite().
The analogWrite function has nothing to do with the analog pins or the analogRead function.
Syntax
analogWrite(pin, value)
Parameters
pin: the Arduino pin to write to. Allowed data types: int.
value: the duty cycle: between 0 (always off) and 255 (always on). Allowed data types: int.
'임베디드 > Arduino' 카테고리의 다른 글
미세먼지 센서 GP2Y1010AU0F (0) | 2020.10.21 |
---|---|
dht22 (0) | 2020.10.21 |
RGB LED 랜덤함수 (0) | 2020.09.18 |
JMOD-BT-01 블루투스 모듈 / dht11 / MIT App Inventor (0) | 2020.09.16 |
blynk dht11 (0) | 2020.09.16 |