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
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
Thank you
Create static and variable Arrays
Moderator: Benj
- QMESAR
- 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
Hi;
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
To create an array select the project explorer and select "add new" The create your variable -Array including the array size etc.
If you select Ok then the Array will show in your project explorer under variable/Globals
Now use you can use a Calculation Icon to initialize the Array to your values you want to place in the Array elements You can do it all in a C Icon however please read the wiki for how to call C variables in C
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.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
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
Have you reached the point of pointers and passing functions as pointers the I will be surprised if you still comment thisso I'm learning C and now flowcode as well, but somehow for the moment I found C more easy
To create an array select the project explorer and select "add new" The create your variable -Array including the array size etc.
If you select Ok then the Array will show in your project explorer under variable/Globals
Now use you can use a Calculation Icon to initialize the Array to your values you want to place in the Array elements You can do it all in a C Icon however please read the wiki for how to call C variables in C
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- 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
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
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 , 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.
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
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 , 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.
-
- 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
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
I'm sure 100 % that is possible to do also in another way inside flowcode somehow... Anyway I start to enjoy Flowcode
I'm sure 100 % that is possible to do also in another way inside flowcode somehow... Anyway I start to enjoy Flowcode
- QMESAR
- 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
Happy to hear thiszumpitu wrote:I'm sure 100 % that is possible to do also in another way inside flowcode somehow... Anyway I start to enjoy Flowcode
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
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- 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
Thank you very much ! I will definitely have a look at that function, right now i'm struggling with the "classic" compiler problem