Skip to content

Instantly share code, notes, and snippets.

@futureshocked
Last active July 30, 2019 00:49
Show Gist options
  • Save futureshocked/a8a79e373c3527bc044af720a1c6f121 to your computer and use it in GitHub Desktop.
Save futureshocked/a8a79e373c3527bc044af720a1c6f121 to your computer and use it in GitHub Desktop.
This sketch demonstrates how to use the Grove rotary potentiometer.
/* 03.040 - Grove rotary potentiometer
*
This sketch demonstrates how to use the Grove rotary potentiometer.
The momentary button is an analog device (i.e. it outputs a voltage
level that depends on the position of the knob).
Components
----------
- Grove Base Shield
- An Arduino Uno compatible board (such as Arduino/Genuino Uno or Seeeduino)
- Grove rotary potentiometer (rotary angle sensor)
- One Grove cable
IDE
---
Arduino IDE
Libraries
---------
-
Connections
-----------
Use a Grove cable to connect the module to Base Shield connector A0.
Other information
-----------------
- Use this sketch along side the video lecture 03.040 of Grove For Busy People
- Grove component: https://txplo.re/7b837
Github Gist
-----------
<script src="https://gist.github.com/futureshocked/a8a79e373c3527bc044af720a1c6f121.js"></script>
https://gist.github.com/futureshocked/a8a79e373c3527bc044af720a1c6f121
For course information, please go to https://techexplorations.com/product/grove-for-busy-people/
Created on July 5 2019 by Peter Dalmaris
*/
int sensorPin = A0; // Analog pin A0 is at Grove connector A0
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600); // Start the serial port
}
void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment