Create static and variable Arrays

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

Moderator: Benj

Post Reply
zumpitu
Posts: 22
Joined: Tue Jul 03, 2018 12:21 pm
Location: Southam UK
Has thanked: 4 times
Been thanked: 2 times
Contact:

Create static and variable Arrays

Post by zumpitu »

Hi All !!

I just spent 2 hours try to make an array like this ... // static float O_O [3] ={1.0, 2.0, 3.0} ; and I'm still not able to do make it workng :(

No matter if I try to make a constant or a variable

All the time I try to make an array and insert the value I have a "syntax" error .. Ok, but where I can find the right syntax? I check a lot of PDF from the website but I was not able to find something like this :?:

Create an Array is very basic things, should be easy to do it :roll:
I also tried to create the array inside a C codebox but also it was not appearing as a variable anyware.

Basically what I want to do is create a static Array and assign in sequence the values to somethings, lets say to a PWM duty cycle, so I can have the same value rotating over and over

"Luckily" (just to be positive ) I will be out of work for a long time so I can experiment, so I'm learning C and now flowcode as well, but somehow for the moment I found C more easy .. something wrong with me :cry:

Thank you

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: Create static and variable Arrays

Post by QMESAR »

Hi;
zumpitu wrote: just spent 2 hours try to make an array like this ... // static float O_O [3] ={1.0, 2.0, 3.0} ; and I'm still not able to do make it workng
Fisrt of all I would advise you to go to online resources in Flowcode and use the Flowcode wiki search for all the stuff you have issues with for example here is the info on creating variables in FC.

http://www.matrixtsl.com/wiki/index.php ... _Variables
The wiki has 95% of the information you need to get going also go the learning center on the Matrix web support page and down load the examples and learn from them
Secondly Flowcode takes the abstraction out of the C language for non programmers and it allows experiences C programmers to do great things however as a beginner either learn C or Flowcode both at the same time and trying to implement what you learn in C directly in Flowcode with no experience is going to cause you big problems and drive you nuts select one and master it before the learning the second one
so I'm learning C and now flowcode as well, but somehow for the moment I found C more easy
Have you reached the point of pointers and passing functions as pointers :shock: the I will be surprised if you still comment this :D :D


To create an array select the project explorer and select "add new"
P1.gif
P1.gif (29.61 KiB) Viewed 5035 times
The create your variable -Array including the array size etc.
P2.gif
P2.gif (60.29 KiB) Viewed 5035 times
If you select Ok then the Array will show in your project explorer under variable/Globals
P4.gif
P4.gif (25.03 KiB) Viewed 5035 times
Now use you can use a Calculation Icon to initialize the Array to your values you want to place in the Array elements
P5.gif
P5.gif (5.27 KiB) Viewed 5035 times
P3.gif
P3.gif (68.32 KiB) Viewed 5033 times
You can do it all in a C Icon however please read the wiki for how to call C variables in C

zumpitu
Posts: 22
Joined: Tue Jul 03, 2018 12:21 pm
Location: Southam UK
Has thanked: 4 times
Been thanked: 2 times
Contact:

Re: Create static and variable Arrays

Post by zumpitu »

Hi QMESAR

Thank you very much for your help ,it worked, but how I can write all in once ? I do not want to look lazy but on my final program I need an array of 72 value :P

Anyway
I'm very used to work with complex software , I work in the automotive industry as a 3D designer for a long time.
I think that the documentation, to me at least, is a bit too much essential, is not easy or clear in many situation.

I have read the page you show me of course, but your tutorial is already much more easy to understand.

This is not at all a complaint or a polemic as I said, but just an observation that something very important can be improved quite a lot in my opinion.

For example, you suggest me to check the Wiki for how to call C variables in C, is even a video tutorial, this is great !
but.. why make a tutorial of only 1 and half minute :shock: , would be good to have an example of all the kind of the variable , show how to use it, ecc... that would take maybe only 5 or 6 minutes video.

zumpitu
Posts: 22
Joined: Tue Jul 03, 2018 12:21 pm
Location: Southam UK
Has thanked: 4 times
Been thanked: 2 times
Contact:

Re: Create static and variable Arrays

Post by zumpitu »

Ok, Just a small update (if anyone is interested ), I made a small excel sheet that will create for me all the code to copy inside the "calculation icon" to assign value at the array, so I do not have to manually wright hundreds of line :D


I'm sure 100 % that is possible to do also in another way inside flowcode somehow... Anyway I start to enjoy Flowcode :mrgreen:

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: Create static and variable Arrays

Post by QMESAR »

zumpitu wrote:I'm sure 100 % that is possible to do also in another way inside flowcode somehow... Anyway I start to enjoy Flowcode
Happy to hear this :D
Not knowing your application or code if you need very large arrays one way that would / could make life easier is using a look up table component
go to Storage >> Lookup table
1.gif
1.gif (74.26 KiB) Viewed 4986 times

zumpitu
Posts: 22
Joined: Tue Jul 03, 2018 12:21 pm
Location: Southam UK
Has thanked: 4 times
Been thanked: 2 times
Contact:

Re: Create static and variable Arrays

Post by zumpitu »

Thank you very much ! I will definitely have a look at that function, right now i'm struggling with the "classic" compiler problem

Post Reply