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
Getting Started Help: LED Array based on Single Integer
Moderator: Benj
-
- Posts: 12
- Joined: Wed Jan 30, 2013 5:21 pm
- Has thanked: 1 time
- Contact:
- 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
Dear ngm
Try this.
Jan Lichtenbelt
Try this.
Jan Lichtenbelt
- Attachments
-
- LED array based on singel ineteger.fcf
- (12.5 KiB) Downloaded 239 times
-
- 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
Hi ngmflowcode,ngmflowcode wrote: Read an integer over I2C and store as my_value
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
-
- 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
Just purchased the full version.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.
-NGM
-
- 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
Hi Jan,Jan Lichtenbelt wrote:Dear ngm
Try this.
Jan Lichtenbelt
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
-
- 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
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
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
-
- 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
I noticed that but it doesn't apply when developing a system that requires I2C protocol.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
-NGM