Page 1 of 1

USB HID arduino leonardo

Posted: Fri Aug 09, 2019 4:11 pm
by kris Werbrouck
The USB HID component for a keyboard doesn't work with a arduino leonardo.

Re: USB HID arduino leonardo

Posted: Fri Aug 09, 2019 4:32 pm
by Benj
Hello,

For the AVR you need to edit the compiler options to allow the USB libraries to be included.

Use the Build -> Compiler options.

Change the AVR compiler setting to.

Location
$(compileravr)batchfiles\avra_usb.bat

Parameters
$(chip:l) "$(outdir)" "$(target)" HID

Then save as a new setting, maybe AVR USB HID.

You also need at least 10mS delays in between the SendData icons.

Let us know how you get on.

Re: USB HID arduino leonardo

Posted: Mon Aug 12, 2019 2:08 pm
by kris Werbrouck
It doesn’t work

Re: USB HID arduino leonardo

Posted: Mon Aug 12, 2019 4:16 pm
by Benj
Hi Kris,

Many thanks for letting me know. I believe I have now tracked down the cause of the problem.

I have updated the USB components and pushed the changes to the update system. Use the Help -> Check for updates menu to get the latest USB component updates.

I have also updated the compiler batch file which needs copying to the following location on your computer.

"C:\Program Files (x86)\Flowcode\Common\Compilers\avr\batchfiles"
avra_usb.bat
(4.03 KiB) Downloaded 222 times
Let us know how you get on.

Re: USB HID arduino leonardo

Posted: Mon Aug 12, 2019 5:54 pm
by kris Werbrouck
The USB HID component doesn't work. There is no error with the compiler.
I use also the built in led of the arduino. With the new compiler options, it doesn't work.

Re: USB HID arduino leonardo

Posted: Tue Aug 13, 2019 11:22 am
by Benj
Thanks for letting me know.

I have replicated the problem here and will see if I can investigate why it's not working for you.

Re: USB HID arduino leonardo

Posted: Tue Aug 13, 2019 1:06 pm
by Benj
Hello,

I've made some minor changes to your program and it's now working well for me.
test flowcode 8 arduino leonardo 4 HID.fcfx
(9.95 KiB) Downloaded 238 times

Re: USB HID arduino leonardo

Posted: Tue Aug 13, 2019 2:58 pm
by kris Werbrouck
Now it works. Thanks.

Re: USB HID arduino leonardo

Posted: Tue Aug 13, 2019 4:51 pm
by Benj
Great glad it's working for you now.

I think it was mainly down to the delay before the initialise to give the PC time to see the bootloader disconnect and the HID device connect.

The other delays are still required as the HID only transfers every 10ms.

Re: USB HID arduino leonardo

Posted: Tue Aug 20, 2019 10:13 am
by kris Werbrouck
Is this also possible in flowcode 7?

Re: USB HID arduino leonardo

Posted: Tue Aug 20, 2019 10:18 am
by Benj
Hello,

Yes this should all work in v7 too. The v7 component should already work but let me know if you have any issues.

Re: USB HID arduino leonardo

Posted: Tue Aug 20, 2019 11:53 am
by kris Werbrouck
The USB HID component works on flowcode 7.

Re: USB HID arduino leonardo

Posted: Tue Aug 20, 2019 1:40 pm
by kris Werbrouck
I try to the USB_Serial component with arduino leonardo. There is a compilation error. (flowcode V7 and V8)