Hi all! I have a design that I need to interact with the potentiometer on my mechanical model. My question is, there a way to get analog data from the potentiometer while a Bar is linked to the potentiometer and the a motor itself, considering that the motor is the one that is making the movement of the block, instead of the mouse clicked? I am having dificulties regarding this animation! I even tried to create a component but I would have to copie all the properties from a potentiometer component.
Thank you very much
Rod
Potentiometer animation
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Potentiometer animation
Hi Rod,
If you add a simulation macro icon to your flowchart and double click the icon.
Inside the icon properties click on the "Functions" tab.
Here you have some extra none downloadable functions you can use to control the Flowcode simulation.
Expand the "Connection" item and in here are some functions to allow you to get or set the value of an ADC channel.
The "SetAn" function requires a floating point number in the range of 0 to 1. This allows the same code to work correctly with a 8-bit ADC through to a 12-bit ADC depending on your target selection.
If you add a simulation macro icon to your flowchart and double click the icon.
Inside the icon properties click on the "Functions" tab.
Here you have some extra none downloadable functions you can use to control the Flowcode simulation.
Expand the "Connection" item and in here are some functions to allow you to get or set the value of an ADC channel.
The "SetAn" function requires a floating point number in the range of 0 to 1. This allows the same code to work correctly with a 8-bit ADC through to a 12-bit ADC depending on your target selection.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 96
- Joined: Fri Jul 15, 2016 10:51 am
- Has thanked: 24 times
- Been thanked: 5 times
- Contact:
Re: Potentiometer animation
Hi Ben sorry If I didnt give you enough explanations about what do I want. I attached my code with the Potentiometer that I desingned and a general potentiometer(ADC Base version 1.3 from general inputs).
In my code I want to get the analog data from the potentiometer linked to a target in this case the motor when it increments and the result to be shown on the lcd. As you can see from the code I only can get data if I click the mouse on the potentiometer(red). I am also having dificulties about creating an analog component with properties similar to the potentiometer and also adding a linked to a specific target(It only shows panel, how do I get to point to a diferent target?)
In my code the bar rotates together with the potentiomer(From input general) and it does not show any changes on the data from the potentimeter reading).
How can I fix this problem?
Thank you
Rod
In my code I want to get the analog data from the potentiometer linked to a target in this case the motor when it increments and the result to be shown on the lcd. As you can see from the code I only can get data if I click the mouse on the potentiometer(red). I am also having dificulties about creating an analog component with properties similar to the potentiometer and also adding a linked to a specific target(It only shows panel, how do I get to point to a diferent target?)
In my code the bar rotates together with the potentiomer(From input general) and it does not show any changes on the data from the potentimeter reading).
How can I fix this problem?
Thank you
Rod
- Attachments
-
- Potentiometer_Example.fcfx
- (14.78 KiB) Downloaded 396 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Potentiometer animation
Hi Rod,
Are you using Flowcode 6 or 7?
Are you using Flowcode 6 or 7?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Potentiometer animation
Hi Rod,
This might do the kind of thing your after. Use the Analogue Inputs windows to see the value of the analogue channel (View -> Analogue Inputs).
This might do the kind of thing your after. Use the Analogue Inputs windows to see the value of the analogue channel (View -> Analogue Inputs).
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Potentiometer animation
Whoops a couple of mistakes in the last example, this one should work better.
- Attachments
-
- Potentiometer_Example.fcfx
- (18.01 KiB) Downloaded 391 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 96
- Joined: Fri Jul 15, 2016 10:51 am
- Has thanked: 24 times
- Been thanked: 5 times
- Contact:
Re: Potentiometer animation
Thanks for the answer Benj! That was exactly what I wanted! The interaction of the potentiometer with the target object. Now It is time for me to figure out the code so I can modify and add greater range of sweep of the bar between 0 and 180 degrees.
Thanks for the help
Rod
Thanks for the help
Rod
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Potentiometer animation
Hi Rod,
Glad I could help.
It might be worth moving all the simulation specific stuff into a separate macro and calling that macro as part of the simulation. Then when you come to download your code to real hardware you can simply disable the call to the macro to remove any additional simulation only code.
Glad I could help.
It might be worth moving all the simulation specific stuff into a separate macro and calling that macro as part of the simulation. Then when you come to download your code to real hardware you can simply disable the call to the macro to remove any additional simulation only code.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel