Page 1 of 1

Getting Started Help: LED Array based on Single Integer

Posted: Sun Feb 03, 2013 2:21 am
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

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

Posted: Sun Feb 03, 2013 2:20 pm
by Jan Lichtenbelt
Dear ngm

Try this.

Jan Lichtenbelt

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

Posted: Sun Feb 03, 2013 2:36 pm
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

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

Posted: Wed Feb 13, 2013 8:49 pm
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

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

Posted: Wed Feb 13, 2013 10:20 pm
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

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

Posted: Wed Feb 13, 2013 10:31 pm
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

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

Posted: Wed Feb 13, 2013 11:32 pm
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