Writes an analog value (PWM wave) to a pin. Can be used to light a LED varying brightnesses or drive a motor at various speeds. After a call to analogWrite(), the pin will generate a steady square wave of the specified duty cycle until the next call to analogWrite() (or a call to digitalRead() or digitalWrite() on the same pin) PWM 1-4 works at 488 Hz. If you need faster operation, use zunoFastPWM() on A0. Check Z-Uno pinout analogWrite(pin, value) pin the pin to write to: PWM1, PWM2, PWM3 and PWM4 value the duty cycle: between 0 (always off) and 255 (always on) (see analogWriteResolution() for more details) None Sets the output to the LED proportional to the value read from the potentiometer.
int val = 0;                   // variable to store the read value

void setup() {

void loop() {
  val = analogRead(A3);        // read the input pin
  analogWrite(PWM1, val / 4);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255