USB HID arduino leonardo

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

Moderator: Benj

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

Postby kris Werbrouck » Fri Aug 09, 2019 4:11 pm

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 15 times

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

Re: USB HID arduino leonardo

Postby Benj » Fri Aug 09, 2019 4:32 pm

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

Postby kris Werbrouck » Mon Aug 12, 2019 2:08 pm

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

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

Re: USB HID arduino leonardo

Postby Benj » Mon Aug 12, 2019 4:16 pm

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.16 KiB) Downloaded 12 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

Postby kris Werbrouck » Mon Aug 12, 2019 5:54 pm

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 386 times
USBHID.FCS
(783 Bytes) Downloaded 10 times
These users thanked the author kris Werbrouck for the post:
Benj (Tue Aug 13, 2019 1:07 pm)
Rating: 5.56%
 

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

Re: USB HID arduino leonardo

Postby Benj » Tue Aug 13, 2019 11:22 am

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: 14130
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4325 times
Been thanked: 4070 times
Contact:

Re: USB HID arduino leonardo

Postby Benj » Tue Aug 13, 2019 1:06 pm

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 22 times
These users thanked the author Benj for the post:
kris Werbrouck (Tue Aug 13, 2019 2:58 pm)
Rating: 5.56%
 

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

Postby kris Werbrouck » Tue Aug 13, 2019 2:58 pm

Now it works. Thanks.
These users thanked the author kris Werbrouck for the post:
Benj (Tue Aug 13, 2019 4:50 pm)
Rating: 5.56%
 

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

Re: USB HID arduino leonardo

Postby Benj » Tue Aug 13, 2019 4:51 pm

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

Postby kris Werbrouck » Tue Aug 20, 2019 10:13 am

Is this also possible in flowcode 7?

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

Re: USB HID arduino leonardo

Postby Benj » Tue Aug 20, 2019 10:18 am

Hello,

Yes this should all work in v7 too. The v7 component should already work but let me know if you have any issues.
These users thanked the author Benj for the post:
kris Werbrouck (Tue Aug 20, 2019 11:53 am)
Rating: 5.56%
 

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

Postby kris Werbrouck » Tue Aug 20, 2019 11:53 am

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

Postby kris Werbrouck » Tue Aug 20, 2019 1:40 pm

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 8 times