Mini Angle Sensor Module Potentiometer Inside Resistance Adjustable GPIO GROVE Connector
Save 0
SKU: U2I-BG-1496838
Share this product
Description
Description:
AN GLE is a rotary switch Unit,simply having a 10K potentiometer inside. This unit can be used for Continuous singal control, such as volume, brightness, or motor speed.
A potentiometer is a manually adjustable, variable resistor with three terminals. Two terminals are connected to a resistive element, the third terminal is connected to an adjustable wiper. The position of the wiper determines the output voltage. The out voltage is captured and converted by AD on ESP32 on portB.
In M5Stack product system, Normally the Grove color indicates the type of communications.
Black: Single BUS (AD ,DA ,GPIO)
Red: I2C
Blue: Uart
White: Others(depends)
The Unit's Grove interface is black, indicating an analog interface that needs to be connected to the M5Core's GROVE B interface.
1.EasyLoader is a simple and fast program burner, and each product page has a product-related case program for EasyLoader.
2.After downloading the software, double-click to run the application, connect the M5 device to the computer via the data cable, select the port parameters, and click "Burn" to start burning.
The code below is incomplete. To get the complete code, please click here.
Example function: Display the digital value converted from the Unit output voltage (0 ~ 4095)
#include <M5Stack.h> // select the input pin for the potentiometer int sensorPin = 36; // last variable to store the value coming from the sensor int last_sensorValue = 0; // current variable to store the value coming from the sensor int cur_sensorValue = 0; void setup() { M5.begin(); pinMode(sensorPin, INPUT); M5.Lcd.setTextSize(2); M5.Lcd.setCursor(0, 0); M5.Lcd.print("the value of AN GLE: "); } void loop() { // read the value from the sensor: cur_sensorValue = analogRead(sensorPin); M5.Lcd.setCursor(0, 25); if(abs(cur_sensorValue - last_sensorValue) > 10){//debaunce M5.Lcd.fillRect(0, 25, 100, 25, BLACK); M5.Lcd.print(cur_sensorValue); last_sensorValue = cur_sensorValue; } delay(50); }