Here's what I've been able to Google. It would be great if someone could let me know if I'm on the right track here.
Code: Select all
Val := YoctoKnob_ButtonVal(ModSN,1)
input := -Val
value := map(input, -1023, 0, 0, 255) ;
GuiControl , , tempbar, %value%
GuiControl , , temptext, %value%
Y := (X-A)/(B-A) * (D-C) + C
So I converted the input from the sensor to a negative number so the scale would run the right direction, i.e. lower numbers now represent lower temps. This calculation, I found with Google, maps the input from the sensor (assuming the sensor values are 0 to 1023) to 0 to 255 for the progress bar.
Does this look correct?