Use Rotary Encoder no counter just up or down
Moderators: grovkillen, Stuntteam, TD-er
-
- New user
- Posts: 5
- Joined: 03 Jan 2021, 23:45
Use Rotary Encoder no counter just up or down
For one of my amps U build an IR transmitter so I can use it form a distance (it's on a cabinet out of reach) with my Logitech remote.
No I like to add a volume control button to my remote so I am able to control it also without remote.
For that I want to use a Rotary Encoder. I have the encoder working, but now I want to be able to know when I turn it clockwise (+1) or counter clockwise (-1) and I do not need the counter for more.
So i like to set it after every turn click to 0 and use a rule to figure out which side is was turned and use that as a command to fire the IR signal.
Is this possible with the standard stack?
No I like to add a volume control button to my remote so I am able to control it also without remote.
For that I want to use a Rotary Encoder. I have the encoder working, but now I want to be able to know when I turn it clockwise (+1) or counter clockwise (-1) and I do not need the counter for more.
So i like to set it after every turn click to 0 and use a rule to figure out which side is was turned and use that as a command to fire the IR signal.
Is this possible with the standard stack?
Re: Use Rotary Encoder no counter just up or down
Have you tried the 'Switch - Rotary encoder' plugin?
I'd expect the counter to go down when turned in the 'opposite' direction, (though I've never used this plugin).
You can detect and handle that in rules.
I'd expect the counter to go down when turned in the 'opposite' direction, (though I've never used this plugin).
You can detect and handle that in rules.
/Ton (PayPal.me)
-
- New user
- Posts: 5
- Joined: 03 Jan 2021, 23:45
Re: Use Rotary Encoder no counter just up or down
I indeed use the rotary encoder plugin it counts down or up. But how do I use that in a rule?
And when I come back later and do the same action it still nows that it goes down or up?
In short, I am only interested in the direction of turning, the counting is not needed for this project
And when I come back later and do the same action it still nows that it goes down or up?
In short, I am only interested in the direction of turning, the counting is not needed for this project
Re: Use Rotary Encoder no counter just up or down
You can add a Dummy Device to your Devices list, give it a useful name, say Variables and enable it.
Then add this to your rules:
Edit: Changed to not turn down the volume when nothing changes but a periodic event is fired (and the Count value doesn't change).
Then add this to your rules:
Code: Select all
on System#Boot do
TaskValueSet,12,1,[Rotary#Count] // Assume the Dummy device is on task 12
endon
on Rotary#Count do
if %eventvalue% > [Variables#Dummy]
// transmit IR volume up command
endif
if %eventvalue% < [Variables#Dummy]
// transmit IR volume down command
endif
TaskValueSet,12,1,%eventvalue% // Store current value
endon
/Ton (PayPal.me)
-
- Normal user
- Posts: 10
- Joined: 25 Jul 2022, 18:21
Re: Use Rotary Encoder no counter just up or down
Hi, this is a long shot as this post was last active in 2021 but..
The code you've posted isn't working for me.
Whenever I turn the encoder I only get this and no IR commands are sent.
my rules are:
The code you've posted isn't working for me.
Whenever I turn the encoder I only get this and no IR commands are sent.
Code: Select all
250812 : Info : QEI : 31
250816 : Info : EVENT: VOL#Counter=31
251612 : Info : QEI : 30
251616 : Info : EVENT: VOL#Counter=30
251912 : Info : QEI : 29
251915 : Info : EVENT: VOL#Counter=29
Code: Select all
on System#Boot do
TaskValueSet,12,1,[VOL#Count] // Assume the Dummy device is on task 12
endon
on Rotary#Count do
if %eventvalue% > [Variables#Dummy]
IRSEND,NEC,0x616E2AD5,32
endif
if %eventvalue% < [Variables#Dummy]
IRSEND,NEC,0x616ECA35,32
endif
TaskValueSet,12,1,%eventvalue% // Store current value
endon
on Switch#State do
if [Switch#State]=1
IRSEND,NEC,0x616E02FD,32
else
IRSEND,NEC,0x616E827D,32
endif
endon
Re: Use Rotary Encoder no counter just up or down
Just to be sure, what build are you using?
Also do you have a task configured with the IR-TX plugin?
Also do you have a task configured with the IR-TX plugin?
Re: Use Rotary Encoder no counter just up or down
Look at your code... it seem that your rotary encoder task is called VOL and the taskvalue is called Count ([VOL#Count])Trelsonowsky wrote: ↑26 Jul 2022, 02:24 my rules are:
CODE: SELECT ALL
on System#Boot do
TaskValueSet,12,1,[VOL#Count] // Assume the Dummy device is on task 12
endon
on Rotary#Count do
if %eventvalue% > [Variables#Dummy]
IRSEND,NEC,0x616E2AD5,32
endif
if %eventvalue% < [Variables#Dummy]
IRSEND,NEC,0x616ECA35,32
endif
TaskValueSet,12,1,%eventvalue% // Store current value
endon
on Switch#State do
So this line:
Code: Select all
on Rotary#Count do
Code: Select all
On VOL#Count Do
Who is online
Users browsing this forum: Google [Bot] and 135 guests