Announcement

Collapse
No announcement yet.

Slider on IoD

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Slider on IoD

    Hi,

    I found that in 4Duino we got TOUCH_MOVING status but IoD doesn't.
    How can I verify the slider moving along with values changing? Any examples on it? Thank you.

  • #2
    Hi,

    Yes thats correct, the IoD doesn't have TOUCH_MOVING status. This is how you achieve the same on the IoD

    Code:
    void loop()
    {
    gfx.touch_Update();
    x = gfx.touch_GetX();
    y = gfx.touch_GetY();
    p = gfx.touch_GetPen();
    
    if(gfx.imageTouched() == iSlider1){
    posn = y - 66 ; // y - top - 8
    if (posn < 0)
    posn = 100 ; // maxvalue-minvalue
    else if (posn > 154) // height - 17)
    posn = 0 ;
    else
    posn = 100 - 100 * posn / 154 ; // max-min - (max-min) * posn / (height-17)
    gfx.UserImages(iSlider1, posn); // Slider1
    }
    
    // put your main code here, to run repeatedly:
    yield(); // Required for ESP
    }
    I hope this helps

    Best regards

    Paul

    Comment

    Working...
    X