Demonstrates analog input by reading an analog sensor and turning on and off a light emitting diode (LED) at a rate determined by the analog sensor reading.

What you’ll learn

In this example, you’ll learn how to:

  1. Stop a sketch that is running
  2. Set up a serial monitor
  3. Read analog input data from a sensor
  4. Use the analog input to control a digital output

You’ll use the serial monitor to see the raw data coming from the sensor.  You’ll be able to control the rate of an LED blinking using the input from a rotary angle sensor.  

Gather your materials

You’ll need the following to complete this tutorial:

This code sample is available on GitHub*.

Для получения подробной информации о возможностях оптимизации компилятора обратитесь к нашему Уведомлению об оптимизации.