- Posts: 224
- Thank you received: 0
Scaling 0-1024 to 0-102
2 years 2 months ago #308179
by slowpoke
Scaling 0-1024 to 0-102 was created by slowpoke
I have an exposed analog from pot value in HAL "arduino.ain.0" (range is 0-1024), and I want to drive "halui.axis.jog-speed" with that value divided by 10
1) Am I best to use mult2, scale or something else?
2) How to implement whatever you suggest?
Much appreciated.
This entire HAL concept and the implementation with HALShow is simply fantastic!
I cobbled together a really rough around the edges (proof of concept) gadget to test messaging before going to an actual PCB and so far so good, All the buttons are working, Pot's next and then a few messages to the display and proof of concept will be complete.
1) Am I best to use mult2, scale or something else?
2) How to implement whatever you suggest?
Much appreciated.
This entire HAL concept and the implementation with HALShow is simply fantastic!
I cobbled together a really rough around the edges (proof of concept) gadget to test messaging before going to an actual PCB and so far so good, All the buttons are working, Pot's next and then a few messages to the display and proof of concept will be complete.
Attachment not found
Please Log in to join the conversation.
2 years 2 months ago #308183
by Benb
Replied by Benb on topic Scaling 0-1024 to 0-102
Attachment not found
Please Log in to join the conversation.
2 years 2 months ago #308203
by slowpoke
Thanks for that.
The visual (block diagram) explanation works much better for me than the plain text explanation that I initially found.
excerpt from my postgui for anyone trying to figure this out in the future.... this works for me:
# Analog Inputs - Jog Speed
loadrt scale count=1
addf scale.0 servo-thread
setp scale.0.offset 0.0
setp scale.0.gain 0.12
net jog-pot-in scale.0.in <= arduino.ain.0
net jog-speed halui.axis.jog-speed <= scale.0.out
Replied by slowpoke on topic Scaling 0-1024 to 0-102
Attachment not found
Thanks for that.
The visual (block diagram) explanation works much better for me than the plain text explanation that I initially found.
excerpt from my postgui for anyone trying to figure this out in the future.... this works for me:
# Analog Inputs - Jog Speed
loadrt scale count=1
addf scale.0 servo-thread
setp scale.0.offset 0.0
setp scale.0.gain 0.12
net jog-pot-in scale.0.in <= arduino.ain.0
net jog-speed halui.axis.jog-speed <= scale.0.out
Please Log in to join the conversation.
Time to create page: 0.080 seconds
