Getting Started Help: LED Array based on Single Integer

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
ngmflowcode
Posts: 12
Joined: Wed Jan 30, 2013 5:21 pm
Has thanked: 1 time
Contact:

Getting Started Help: LED Array based on Single Integer

Post by ngmflowcode »

Here's a little pseudo code for what I am looking to do and could use some help implementing this in flowcode. Do I need to use a switch, a decision and a calculation for this?

Read an integer over I2C and store as my_value

If (my_value < 26){
LED1 = ON
LED2 = OFF
LED2 = OFF}

else if (my_value > 26 AND my value < 51){
LED1 = ON
LED2 = ON}

It would be a huge help if someone is able to create a flowcode file to demonstrate this. This is a small part of my project but would certainly help give me a better idea of the logic behind the program as I've found the documentation a little confusing.

Thanks

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: Getting Started Help: LED Array based on Single Integer

Post by Jan Lichtenbelt »

Dear ngm

Try this.

Jan Lichtenbelt
Attachments
LED array based on singel ineteger.fcf
(12.5 KiB) Downloaded 239 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Getting Started Help: LED Array based on Single Integer

Post by medelec35 »

ngmflowcode wrote: Read an integer over I2C and store as my_value
Hi ngmflowcode,
Even though you have posted in 'Flowcode V5 Free Edition' section are you using Flowcode V5 Free?
If so you will be unable to compile Flowchart that uses I2C to hex or send to your target device via EB006 programming Eblock for example.
You willy only be able to use I2C, RS232 or other comms with Professional versions.
Also you only have a few microcontrollersyou can select. So you will need ti change your target device from 16F1939 in the flowchart
Jan kindly posted

Martin
Martin

ngmflowcode
Posts: 12
Joined: Wed Jan 30, 2013 5:21 pm
Has thanked: 1 time
Contact:

Re: Getting Started Help: LED Array based on Single Integer

Post by ngmflowcode »

Even though you have posted in 'Flowcode V5 Free Edition' section are you using Flowcode V5 Free?
If so you will be unable to compile Flowchart that uses I2C to hex or send to your target device via EB006 programming Eblock for example.
Just purchased the full version.

-NGM

ngmflowcode
Posts: 12
Joined: Wed Jan 30, 2013 5:21 pm
Has thanked: 1 time
Contact:

Re: Getting Started Help: LED Array based on Single Integer

Post by ngmflowcode »

Jan Lichtenbelt wrote:Dear ngm

Try this.

Jan Lichtenbelt
Hi Jan,

Thanks for the example. Let me comment piece by piece in sections:

Initialize I2C
|
Start I2C
|
I think there needs to be another I2C operation here in which we issue the address that we want to read from
is there a way to simulate an EEPROM in fc?
|
Read first Byte

The LED logic works for 2 LEDs but there is a simpler way to do that by using an LED array. I've successfully got that part down. Let me know if you want me to share that as an example.

-NGM

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Getting Started Help: LED Array based on Single Integer

Post by dazz »

Hi
If you add an eeprom component then read /write to it in code you should see the changes on the panel, search the forums as there are a couple of eeprom write examples which simulate well
Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

ngmflowcode
Posts: 12
Joined: Wed Jan 30, 2013 5:21 pm
Has thanked: 1 time
Contact:

Re: Getting Started Help: LED Array based on Single Integer

Post by ngmflowcode »

dazz wrote:Hi
If you add an eeprom component then read /write to it in code you should see the changes on the panel, search the forums as there are a couple of eeprom write examples which simulate well
Regards
Dazz
I noticed that but it doesn't apply when developing a system that requires I2C protocol.

-NGM

Post Reply