B4R Library [code modules] Keyboard, Mouse, etc...

In the attached .zip is a project that includes and demonstrates the use of three code modules. Keyboard.bas and Mouse.bas wrap the Arduino Keyboard and Mouse libraries using their own syntax.

Reference: https://www.arduino.cc/en/Reference/MouseKeyboard

There is also a Robo.bas module that uses the same syntax as the jAWTRobot library. This enables you to use the jAWTRobot library in B4J to test out code before pasting it into a B4R project.

This library works only on boards that don't use a dedicated USB-Serial chip (like an FTDI chip or a CH340). The Leonardo and the Pro Micro are examples of boards where the main processor also provides USB functionality. These boards can make use of these code modules.
 

Attachments

  • KeyboardMouse.zip
    5.4 KB · Views: 575

Mostez

Well-Known Member
Licensed User
Longtime User
Hello,
I've tried the code and it works ok, just wanted to ask if it's possible to control character sending speed! because I use leonardo to emulate keyboard, the software on PC performs text check every time it receives a new character (textbox text changed event) I want to allow PC to finish text check before receiving next character.

for now, I used delay inside for next loop,
B4X:
For m = 0 To 9
        Keyboard.Write2 (Arr(m))
        Delay(10)
    Next
 

Roycefer

Well-Known Member
Licensed User
Longtime User
If the Delay call doesn't interfere with other tasks like receiving Serial data then you can just stick with the Delay calls. If you want something that doesn't block, you can try using CallSubPlus or a Timer. But this is more about program flow than it is about the KeyboardMouse library. The library just sends the keystrokes at the speed at which the code is executed.
 
Top