I2C Keyboard 8x8 device

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

Moderator: Benj

johnsondav
Posts: 150
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 78 times
Been thanked: 142 times
Contact:

I2C Keyboard 8x8 device

Postby johnsondav » Wed Dec 13, 2017 4:39 pm

Hi everyone

I am working on a prototype device which, will scan a keyboard ( will be up to a full 80 plus keys) and send the key pressed to your project, using the I2C protocol. This device is independent to your project, therefore, it requires a FC7 component to communicate with it.
Everything is working well so far, but I need to be able to get the graphic the way I want it for the FC7 component. This is what it looks like so far:

FC7_keyboard.jpg
FC7_keyboard.jpg (27.24 KiB) Viewed 812 times


Q. How do I get a suitable graphic of a keyboard to display correctly within FC7. When I put a jpeg file attachment to the component is only shows a white square. :roll:

I am hoping to get the device along with the tutorial guide on how to build it and the FC7 component, ready for early in the new year.

Regards
Dave
Last edited by johnsondav on Thu Dec 14, 2017 9:01 pm, edited 1 time in total.

User avatar
LeighM
Matrix Staff
Posts: 1275
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 318 times
Been thanked: 466 times
Contact:

Re: I2C Keyboard 8x8 device

Postby LeighM » Wed Dec 13, 2017 7:51 pm

Hi Dave,
Sounds good :D
You could try adding the image as a resource, via the export component properties menu,
Then add a rectangle object and add the resource to the image property of the rectangle

johnsondav
Posts: 150
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 78 times
Been thanked: 142 times
Contact:

Re: I2C Keyboard 8x8 device

Postby johnsondav » Wed Dec 13, 2017 9:23 pm

Hi LeighM

Thanks you for suggestion. This is what is displayed within the component build:

KB Component1.png
KB Component1.png (56.25 KiB) Viewed 803 times


This is what is displayed when the component is placed in a project:
KB Component2.png
KB Component2.png (9.01 KiB) Viewed 803 times


There is a small red exclamation mark next to the image file, not sure what it means.

Regards
Dave

User avatar
LeighM
Matrix Staff
Posts: 1275
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 318 times
Been thanked: 466 times
Contact:

Re: I2C Keyboard 8x8 device

Postby LeighM » Thu Dec 14, 2017 10:56 am

Thanks, yes, there is something odd here, I'm investigating...

User avatar
LeighM
Matrix Staff
Posts: 1275
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 318 times
Been thanked: 466 times
Contact:

Re: I2C Keyboard 8x8 device

Postby LeighM » Thu Dec 14, 2017 3:14 pm

Hi Dave

Well it looks like you have identified a recently introduced bug in the component resource feature, which is inhibiting their selection as an image to a drawing primitive.
The exported component will need the resource feature to work for images to be visible to component users. So it’s something that we have raised here as needing fixing in the Flowcode executable.

As a temporary workaround, using the absolute path, rather than relative, to the image for the image property should enable the image to be seen in the exported component. But only on your PC that has access to the image. Hopefully that will allow you to continue working on the component.

Regards,
Leigh
These users thanked the author LeighM for the post:
johnsondav (Thu Dec 14, 2017 3:41 pm)
Rating: 5.88%
 

johnsondav
Posts: 150
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 78 times
Been thanked: 142 times
Contact:

Re: I2C Keyboard 8x8 device

Postby johnsondav » Thu Dec 14, 2017 3:41 pm

Hi Leigh

Very much appreciate your help. However, putting the full extension details in has not solved the problem.
No matter, it will not prevent me from continuing to developing this component until such time the issue can be resolved.

Regards
Dave

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

Re: I2C Keyboard 8x8 device

Postby Benj » Fri Dec 15, 2017 4:38 pm

Hi Dave,

I've found a workaround using the Component -> Initialise event.

You add the image to the resource manager as usual.

Then enable the Initialise event and assign a macro.

Inside the event macro use the File.AbsPath function to get a path to the file as a string.

You can then assign this to the "Image" property of the component.

This seems to work well but obviously is not as cool as being able to load the image directly.

Here is a demo you can follow.
v7.fcfx
(8.24 KiB) Downloaded 12 times


Let us know how you get on.
These users thanked the author Benj for the post:
johnsondav (Fri Dec 15, 2017 8:26 pm)
Rating: 5.88%
 

johnsondav
Posts: 150
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 78 times
Been thanked: 142 times
Contact:

Re: I2C Keyboard 8x8 device

Postby johnsondav » Fri Dec 15, 2017 8:24 pm

Hi Ben & Leigh

You guys are brilliant. Solved. :D

Component1.jpg
Component1.jpg (81.11 KiB) Viewed 748 times


Hope you both and your families have a wonderful christmas.

★˛˚˛*˛°.˛*.˛°˛.*★˚˛*˛°.˛*.˛°˛.*★Merry*★* 。*˛.
˛°_██_*.。*./ ♥ \ .˛* .˛。.˛.*.★* Christmas*★ 。*
˛. (´• ̮•)*.。*/♫.♫\*˛.* ˛_Π_____.♥Everyone ♥ ˛* ˛*
.°( . • . ) ˛°./• '♫ ' •\.˛*./______/~\*. ˛*.。˛* ˛.*。
*(...'•'.. ) *˛╬╬╬╬╬˛°.|田田 |門|╬╬╬╬╬*˚ .˛ ...


Regards
Dave
These users thanked the author johnsondav for the post:
Benj (Sat Dec 16, 2017 10:10 pm)
Rating: 5.88%
 

johnsondav
Posts: 150
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 78 times
Been thanked: 142 times
Contact:

Re: I2C Keyboard 8x8 device

Postby johnsondav » Fri Dec 29, 2017 8:33 pm

Hi Everyone

The project to build this device is now available here:

https://www.matrixtsl.com/mmforums/viewtopic.php?f=66&t=19658

Here is the Keyboard/Pad component for you to place in your own component library:
I2C_KB.fcpx
(916 Bytes) Downloaded 14 times


Here is project that makes the keyboard component:
Keyboard I2C Component.fcfx
(26.28 KiB) Downloaded 13 times


You will need this image file for the above project to create the component correctly:
Keypad 4x4 copy.jpg
Keypad 4x4 copy.jpg (37.52 KiB) Viewed 461 times

Right click and save the image to the same folder as the project.

Full construction details are provided for this project if you follow the above link.

Regards
Dave
These users thanked the author johnsondav for the post (total 2):
jgu1 (Tue Jan 02, 2018 7:57 pm) • Genilsonsa (Wed Jan 10, 2018 12:37 am)
Rating: 11.76%
 

johnsondav
Posts: 150
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 78 times
Been thanked: 142 times
Contact:

Re: I2C Keyboard 8x8 device

Postby johnsondav » Sat Jan 13, 2018 5:22 pm

Hi Everyone

You may wish to experiment with using this component. Here is an example of how the keyboard component is used:
I2C Keyboard example.fcfx
(10.57 KiB) Downloaded 19 times


All the information required to follow this project is available using the above link.

Regards
Dave
These users thanked the author johnsondav for the post (total 3):
QMESAR (Sat Jan 13, 2018 6:28 pm) • medelec35 (Sat Jan 13, 2018 7:55 pm) • Benj (Mon Jan 15, 2018 12:14 pm)
Rating: 17.65%