Manufacturers

RSS feed

No RSS feed added

Linkerkit Rotary Potentiometer Module

Linkerkit Rotary Potentiometer Module with a 10k ohm pot provides a handy method to provide variable control to your project via an analog to digital converter (ADC) built into your microcontroller.

More details


AU$3.22

LKT-00172

4 items in stock

Add to my wishlist

Loyalty program By buying this product you can collect up to 3 loyalty points. Your cart will total 3 points that can be converted into a voucher of AU$0.06.


100 quantities 75 quantities 50 quantities 25 quantities 10 quantities 5 quantities
-AU$0.36 -AU$0.35 -AU$0.34 -AU$0.33 -AU$0.32 -AU$0.29

Manufacturer: Linksprite

Description: Linkerkit Rotary Potentiometer Module with a 10k pot provides a handy method to provide variable control to your project via an analog to digital converter (ADC) built into your microcontroller.

Arduino example sketch:

/*
  ReadAnalogVoltage
  Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor.
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
 
 This example code is in the public domain.
 */

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (5.0 / 1023.0);
  // print out the value you read:
  Serial.println(voltage);
}

pcDuino (Arduino style) example:

#include <core.h>

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (5.0 / 1023.0);
  // print out the value you read:
  Serial.println(voltage);
}

pcDuino native C/C++ analog input example

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <fcntl.h>

#include <unistd.h>

#define ADC_PATH "/proc/"

#define ADC_FILE "adc"

char path[80];  // create large buffer for file paths

int adc[6];     // Array for file descriptors for the adc pins

int main(void)

{

        // create ADC pin file descriptors

        for (int i = 0; i <= 5; i++)

        {

                memset( path, 0, sizeof(path));

                sprintf( path, "%s%s%d", ADC_PATH, ADC_FILE, i);

                adc[i] = open(path, O_RDONLY);

        }

        // now we can read the analog 'file streams'

        for (int i = 0; i <= 5; i++)

        {

                char ADCBuf[16];

                lseek(adc[i], 0, SEEK_SET);

                int res = read(adc[i], ADCBuf, sizeof(ADCBuf));

                int ADCResult = atoi(ADCBuf);

                printf("ADC pin: %d Value: %s", i, ADCBuf);

        }

}

No customer comments for the moment.

Only registered users can post a new comment.

Cart  

No products

Shipping AU$0.00
Total AU$0.00

Check out