Getting Started with the Grove Rotary Potentiometer

From High Speed Systems Engineering Lab
Jump to: navigation, search

Hookup

  1. Connect the rotary potentiometer to port A0
  2. Connect the LED bar module to port D2

"Open" light sensor "Closed" light sensor

Example Code

Rpl example sensor led bar video.png Watch this video to try out this sensor and an LED bar.

Ardublock Code

!!!

>>>>NOTE<<<< Although this code shows "Rotary Angle Sensor," it also works for the slide potentiometer, temperature sensor, moisture sensor, and light sensor since they do not have their own blocks

!!!

Programming the LED bar and an analog sensor

Arduino Code

 #include <LED_Bar.h>
 
 LED_Bar mesLeds(3,2);
 
 void setup()
 {
 }
 
 void loop()
 {
   mesLeds.displayVoltage(analogRead(0));
 }