Component: Potentiometer (Sensors: EBM Modules)

From Flowcode Help
Jump to navigationJump to search


Author Matrix TSL
Version 1.1 (Release)
Category Sensors: EBM Modules


Image Potentiometer component

This board consists of a standard shaft rotary potentiometer that provides a linear voltage output ranging between the microcontroller power rails. This can be connected to an Analogue to Digital input of the microcontroller in order to provide a control value.

Examples

This example simply reads the value from the potentiometer sensor component and outputs the value to an LCD as a number in the range 0-255. FC6 Icon.png EBM002 Example The ADC bit depth can be increased to 10 or 12 bit depending on your device by changing the Mode parameter to 1 in the ReadPotentiometer component macro.

Downloadable macro reference

ReadPotentiometer

Macro to read the potentiometer

Mode = 0 will return a byte

Mode = 1 will return an int

Parameters

BOOL Mode
0 = return BYTE, 1 = return INT


Return value

INT


Simulation macro reference

This component does not contain any simulation macros


Property reference

Channel 1

This property is of type Single analog pin and can be referenced with the variable name CHANNEL1.

No additional information


VRef voltage

This property is of type Signed integer and can be referenced with the variable name vrefvol.

+Vref voltage x 10mV

Default 500 = 5V

VRef option

This property is of type Fixed list of ints and can be referenced with the variable name vrefop.

Defines what is used as the ADC Vref source.

Conversion speed

This property is of type Fixed list of ints and can be referenced with the variable name convspd.

Clock setting to set how fast the ADC peripheral is driven.

Aquisition cycles

This property is of type Signed integer and can be referenced with the variable name actime.

Number of micro seconds to wait for the ACD input to charge before starting the analogue sample.