User Manual

Code Analysis
rotaryValue = analogRead(rotaryPin);
Description:
Reads the value from the specified analog pin. Arduino boards contain a multichannel, 10-bit
analog to digital converter. This means that it will map input voltages between 0 and the
operating voltage(5V or 3.3V) into integer values between 0 and 1023. On an Arduino UNO, for
example, this yields a resolution between readings of: 5 volts / 1024 units or, 0.0049 volts (4.9
mV) per unit.
Syntax:
analogRead(pin)
Parameters:
pin: the name of the analog input pin to read from (A0 to A5 on most boards).
Returns: The analog reading on the pin. Although it is limited to the resolution of the analog to
digital converter (0-1023 for 10 bits or 0-4095 for 12 bits). Data type: int.
This function is used to read the value of Analog pins(the rotary sensor position), the range of
values is: 0 ~ 1023.
delay(rotaryValue);
Delay function, The millisecond duration of the delay is the value in parentheses. Because the
value is the value of the analog signal of the knob pin being read, so the delay time can be
controlled by the knob.
Demo Effect and Serial Print Result:
Turning the Potentiometer will change the frequency of LED flickering.
Breakout Guide
Use a Grove cable to connect LED to Seeeduino Lotus’s digital interface D4, and a Grove cable
to connect the Grove Rotary Switch to analog signal interface A0.
23
Grove Beginner Kit For Arduino®