I2C Keyboard 8x8 device

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

Moderator: Benj

Post Reply
johnsondav
Posts: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times
Contact:

I2C Keyboard 8x8 device

Post by johnsondav »

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 6775 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: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: I2C Keyboard 8x8 device

Post by LeighM »

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: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times
Contact:

Re: I2C Keyboard 8x8 device

Post by johnsondav »

Hi LeighM

Thanks you for suggestion. This is what is displayed within the component build:
KB Component1.png
(56.25 KiB) Downloaded 3146 times
This is what is displayed when the component is placed in a project:
KB Component2.png
(9 KiB) Downloaded 3146 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: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: I2C Keyboard 8x8 device

Post by LeighM »

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

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: I2C Keyboard 8x8 device

Post by LeighM »

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

johnsondav
Posts: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times
Contact:

Re: I2C Keyboard 8x8 device

Post by johnsondav »

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

Re: I2C Keyboard 8x8 device

Post by Benj »

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

johnsondav
Posts: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times
Contact:

Re: I2C Keyboard 8x8 device

Post by johnsondav »

Hi Ben & Leigh

You guys are brilliant. Solved. :D
Component1.jpg
Component1.jpg (81.11 KiB) Viewed 6711 times
Hope you both and your families have a wonderful christmas.

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


Regards
Dave

johnsondav
Posts: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times
Contact:

Re: I2C Keyboard 8x8 device

Post by johnsondav »

Hi Everyone

The project to build this device is now available here:

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 248 times
Here is project that makes the keyboard component:
Keyboard I2C Component.fcfx
(26.28 KiB) Downloaded 260 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 6424 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

johnsondav
Posts: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times
Contact:

Re: I2C Keyboard 8x8 device

Post by johnsondav »

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 287 times
All the information required to follow this project is available using the above link.

Regards
Dave

Post Reply