Skip to content

[15] Potentiometer module

Features:

  • 3 analog knobs
  • 3 buttons
  • 3 individual brightness leds

Arduino example: 15_potentiometer.ino

TotemModule module(15);

Totem Module 15

Module commands

Before start

• Install programming environment by following tutorial on Arduino setup.
• Join our community forum for any questions: https://forum.totemmaker.net.

Command naming convention

Some commands controls various channels (A, B, C, ...). There is a logic behind command naming for flexibility:
write("commandA", 10) - will set value 10 for individual channel A.
write("commandAll", 100) - will set value 100 for all existing channels.
write("commandABCD", 10, 20, 30, 40) - will set individual values for A, B, C, D channels.
write("commandABC", 10, 20, 30) - will set individual values for A, B, C channels.
Only commands listed in "Module commands" will be accepted. Other variations will be discarded.
All commands are case sensitive! Calls like CommandA, COMMANDa, motorA/BRAKE will be ignored.

Knob

knobA ( )

knobB ( )

knobC ( )

Get knob position. (0, 128, 255) = (left, center, right).
Returned value range depends on knobAll/bits setting.
Returns: knob position [0:255].
int knobPos = module.readWait("knobA").getInt();

knobAll/bits ( bits )

Set knob resolution. Allowed values:
6 - [0:64]
8 - [0:256] (default)
10 - [0:1024]
12 - [0:4096]
Parameter:
bits - knob analog resolution. [6;8;10;12].
Default: 18.
module.write("knobAll/bits", 10); // Set knob to 10 bit resolution

LED

ledA ( alpha )

ledB ( alpha )

ledC ( alpha )

ledAll ( alpha )

Set LED brightness. Can change individual channel A, B, C or all with command ledAll.
When led is set manually, knob position display is disabled. To re-enable write command ledAll/reset.
Parameter:
alpha - brightness [0:100]%.
module.write("ledA", 50); // Set ledA to 50% brightness
module.write("ledC", 100); // Set ledC to 100% brightness
module.write("ledAll", 50); // Set led A,B,C to 50% brightness

ledAll/reset ( )

Reset LED to its default behavior - knob position display.
module.write("ledAll/reset");

Button

buttonA ( )

buttonB ( )

buttonC ( )

Get button state (true, false) = (pressed, released).
Returns: is pressed [true:false].
bool isPressed = module.readWait("buttonA").getInt(); // Get button A state
module.subscribe("buttonA"); // will call onModuleData event when button is pressed