Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: Auto scroll teensy 3.2

  1. #1
    Junior Member santoslao's Avatar
    Join Date
    May 2021
    Location
    BZ
    Posts
    4

    Auto scroll teensy 3.2

    hello i'm ours in the programming and here in the community.

    I am easy to understand, I would like to know, how can I program in a tiny 3.2 an automatic scroll by time? Would anyone have this code ready so that I could start my project?

    Example: I need to scroll down one page every 30 seconds, as if I were doing this with a normal mouse.

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,796
    one page every 30 seconds? why not just do PAGE DOWN keycode?

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,239
    You could use something like this:

    Code:
    void setup() {
    }
    
    void loop() {
      Mouse.scroll(20);
      delay(30000);
    }
    Don't forget to set Tools > USB Type to one of the options including Mouse, so Teensy becomes a USB mouse after you upload the code.

    Details on the mouse features here:
    https://www.pjrc.com/teensy/td_mouse.html

  4. #4
    Junior Member santoslao's Avatar
    Join Date
    May 2021
    Location
    BZ
    Posts
    4
    Quote Originally Posted by tonton81 View Post
    one page every 30 seconds? why not just do PAGE DOWN keycode?
    I'm new to programming with teensy, but if you suggested page down can you pass me the code? I confess that I really don't know how to do it. I want to learn more from colleagues on the forum.

  5. #5
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,796
    https://www.pjrc.com/teensy/td_keyboard.html

    it uses keyboard keystrokes, look for KEY_PAGE_DOWN

    Code:
    Keyboard.press(KEY_PAGE_DOWN);
    Keyboard.release(KEY_PAGE_DOWN);

  6. #6
    Junior Member santoslao's Avatar
    Join Date
    May 2021
    Location
    BZ
    Posts
    4
    Quote Originally Posted by PaulStoffregen View Post
    You could use something like this:

    Code:
    void setup() {
    }
    
    void loop() {
      Mouse.scroll(20);
      delay(30000);
    }
    Don't forget to set Tools > USB Type to one of the options including Mouse, so Teensy becomes a USB mouse after you upload the code.

    Details on the mouse features here:
    https://www.pjrc.com/teensy/td_mouse.html
    worked correctly

  7. #7
    Junior Member santoslao's Avatar
    Join Date
    May 2021
    Location
    BZ
    Posts
    4
    Quote Originally Posted by tonton81 View Post
    https://www.pjrc.com/teensy/td_keyboard.html

    it uses keyboard keystrokes, look for KEY_PAGE_DOWN

    Code:
    Keyboard.press(KEY_PAGE_DOWN);
    Keyboard.release(KEY_PAGE_DOWN);
    for my project it doesn't work with page down, only with scroll. But I appreciate the help

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,239
    Quote Originally Posted by santoslao View Post
    for my project it doesn't work with page down, only with scroll.
    Well then, the good news is you can use Mouse.scroll(num); (as mentioned in msg #3)

    The "num" input is a signed integer for how many clicks of the scroll wheel Teensy transmits to your PC.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •