USB HID arduino leonardo

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
kris Werbrouck
Posts: 18
Joined: Mon Feb 25, 2013 10:15 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

USB HID arduino leonardo

Post by kris Werbrouck »

The USB HID component for a keyboard doesn't work with a arduino leonardo.
Attachments
test flowcode 8 arduino leonardo 4 HID.fcfx
(9.43 KiB) Downloaded 212 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB HID arduino leonardo

Post 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.

kris Werbrouck
Posts: 18
Joined: Mon Feb 25, 2013 10:15 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: USB HID arduino leonardo

Post by kris Werbrouck »

It doesn’t work
Attachments
settings.jpg
settings.jpg (61.84 KiB) Viewed 5850 times
USBHIDPage1.jpg
USBHIDPage1.jpg (129.97 KiB) Viewed 5850 times
USBHIDPage2.jpg
USBHIDPage2.jpg (141.09 KiB) Viewed 5850 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB HID arduino leonardo

Post 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 217 times
Let us know how you get on.

kris Werbrouck
Posts: 18
Joined: Mon Feb 25, 2013 10:15 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: USB HID arduino leonardo

Post 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.
Attachments
USBHID.jpg
USBHID.jpg (38.46 KiB) Viewed 5835 times
USBHID.FCS
(773 Bytes) Downloaded 196 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB HID arduino leonardo

Post 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.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB HID arduino leonardo

Post 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 234 times

kris Werbrouck
Posts: 18
Joined: Mon Feb 25, 2013 10:15 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: USB HID arduino leonardo

Post by kris Werbrouck »

Now it works. Thanks.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB HID arduino leonardo

Post 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.

kris Werbrouck
Posts: 18
Joined: Mon Feb 25, 2013 10:15 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: USB HID arduino leonardo

Post by kris Werbrouck »

Is this also possible in flowcode 7?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB HID arduino leonardo

Post 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.

kris Werbrouck
Posts: 18
Joined: Mon Feb 25, 2013 10:15 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: USB HID arduino leonardo

Post by kris Werbrouck »

The USB HID component works on flowcode 7.

kris Werbrouck
Posts: 18
Joined: Mon Feb 25, 2013 10:15 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: USB HID arduino leonardo

Post by kris Werbrouck »

I try to the USB_Serial component with arduino leonardo. There is a compilation error. (flowcode V7 and V8)
Attachments
TestUSBSerial.fcfx
(8.71 KiB) Downloaded 126 times

Post Reply