Due to high demand expect some shipping delays at this time, orders may not ship for 3-4 business days. On MLK Day no orders will be shipped.
0

Rotary Trinkey
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Rotary Trinkey

by Fishe on Sun Nov 28, 2021 12:27 pm

I purchased 5 Rotary Trinkeys in the hope of ganging them up to control volume by Windows application. I do not know if this is possible and my coding skills are minimal. I there a way to modify the Arduino code for the volume control to control by application instead of windows wide control?

Fishe
 
Posts: 35
Joined: Mon Apr 25, 2016 8:50 pm

Re: Rotary Trinkey

by mikeysklar on Tue Nov 30, 2021 4:37 pm

@Fishe,

You could use in-app volume control keycodes, but you will be to be selected on the app.

We do have a CircuitPython example of controlling YouTube position, but you have to be selected on youtube and the rotary encoder will send ',' or '.' to scroll through the video.

Code: Select all | TOGGLE FULL SIZE
"""Rotary Trinkey YouTube Frame-by-Frame Example"""
import time
import rotaryio
import board
import digitalio
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS

print("Rotary Trinkey YouTube Frame-by-Frame example")

encoder = rotaryio.IncrementalEncoder(board.ROTA, board.ROTB)
switch = digitalio.DigitalInOut(board.SWITCH)
switch.switch_to_input(pull=digitalio.Pull.DOWN)

time.sleep(1)  # Sleep for a bit to avoid a race condition on some systems
keyboard = Keyboard(usb_hid.devices)
keyboard_layout = KeyboardLayoutUS(keyboard)  # We're in the US :)

switch_state = None
last_position = encoder.position

while True:
    current_position = encoder.position
    position_change = current_position - last_position
    if position_change > 0:
        for _ in range(position_change):
            keyboard_layout.write('.')
        print(current_position)
    elif position_change < 0:
        for _ in range(-position_change):
            keyboard_layout.write(',')
        print(current_position)
    last_position = current_position
    if not switch.value and switch_state is None:
        switch_state = "pressed"
    if switch.value and switch_state == "pressed":
        print("switch pressed.")
        keyboard_layout.write(' ')
        switch_state = None

mikeysklar
 
Posts: 6477
Joined: Mon Aug 01, 2016 8:10 pm

Re: Rotary Trinkey

by Fishe on Tue Nov 30, 2021 4:55 pm

Let me clarify, I am looking to control volume in app individually, like chrome, discord, iRacing and Master while in a game. There is this https://github.com/omriharel/deej which I am trying

Fishe
 
Posts: 35
Joined: Mon Apr 25, 2016 8:50 pm

Re: Rotary Trinkey

by mikeysklar on Wed Dec 01, 2021 5:00 pm

The deej repo you found look exactly like the individual app control you desire. Were you able to install it and get it running with the rotary trinkey?

mikeysklar
 
Posts: 6477
Joined: Mon Aug 01, 2016 8:10 pm

Re: Rotary Trinkey

by Fishe on Wed Dec 01, 2021 7:24 pm

I am not that smart, was hoping rather was a variation of the three command “Media_volume” whereas you could call the application. I am going to build the Deej first then move over to the trinkey

Fishe
 
Posts: 35
Joined: Mon Apr 25, 2016 8:50 pm

Re: Rotary Trinkey

by Christopher37 on Wed Dec 01, 2021 11:34 pm

Since the Deej program that runs on your computer seems to just be looking for a string of "|" pipe separated values, anything that can create a serial connection and send a string of values should be able to the control the Deej program.

You could use the rotary encoder to move a number between 0 and 1023 for sending to the Deej program; but it looks like with the Rotary Trinkey you would need to have 5 USB ports to plug them into and an even bigger problem is it looks like the Deej program expects a single string of values from only a single COM port.

You would be better served with something like an Adafruit QT Py board ( https://www.adafruit.com/product/4600 ) and 5 STEMMA QT Adafruit I2C QT Rotary Encoders ( https://www.adafruit.com/product/4991 ). You would then still need to write the code to use the rotary encoders to modify values and send the string over the serial port.

Christopher37
 
Posts: 3
Joined: Sat Dec 02, 2017 11:13 pm

Re: Rotary Trinkey

by Fishe on Fri Dec 17, 2021 7:33 pm

Thank you, I didn’t see this till just now. That is pretty much what I have found and like the Stemma route the best

Fishe
 
Posts: 35
Joined: Mon Apr 25, 2016 8:50 pm

Re: Rotary Trinkey

by Fishe on Tue Dec 21, 2021 11:33 pm

Can I store the Deej Client on a board and have it install to a computer

Fishe
 
Posts: 35
Joined: Mon Apr 25, 2016 8:50 pm

Re: Rotary Trinkey

by Fishe on Fri Dec 31, 2021 4:38 pm

I went with the QT PY and 5 breakout boards for the rotary encoder. I am seeing a problem noted in the forum regarding the turning of the know decreases the value instead of increasing. Also, it posts that the button was pressed.

At this point I am using the base arduino example.

Fishe
 
Posts: 35
Joined: Mon Apr 25, 2016 8:50 pm

Re: Rotary Trinkey

by Fishe on Sat Jan 01, 2022 12:28 pm

Fixed the negative

Serial.println(-new_position); // display new position (-)

Fishe
 
Posts: 35
Joined: Mon Apr 25, 2016 8:50 pm

Please be positive and constructive with your questions and comments.