03-30-2024 10:02 AM
Good morning,
I'm currently working on a project with LabVIEW and Arduino, and I need help implementing a specific feature. My goal is to read the value of a potentiometer plugged into Arduino using LabVIEW and then light up different LEDs based on that value.
More specifically, here is what I want to achieve:
Read the value of the potentiometer connected to Arduino from LabVIEW.
If the value read is greater than or equal to 3, turn on an LED connected to pin 7 of the Arduino.
Otherwise, if the value is less than 3, turn on another LED connected to pin 8 of the Arduino.
Being a beginner, I am asking for your advice and suggestions to improve the structure of my code, in particular by using the LabVIEW case structure effectively.
I thank you in advance for any help you can give me.
Solved! Go to Solution.
03-30-2024 09:56 AM
Bonjour,
Je travaille actuellement sur un projet avec LabVIEW et Arduino et j'ai besoin d'aide pour implémenter une fonctionnalité spécifique. Mon objectif est de lire la valeur d'un potentiomètre branché sur Arduino à l'aide de LabVIEW, puis d'allumer différentes LED en fonction de cette valeur.
Plus précisément, voici ce que je souhaite réaliser :
Lisez la valeur du potentiomètre connecté à Arduino depuis LabVIEW.
Si la valeur est supérieure ou égale à 3, allumez une LED connectée à la broche 7 de l'Arduino.
Sinon, si la valeur est inférieure à 3, allumez une autre LED connectée à la broche 8 de l'Arduino.
Etant débutant, je sollicite vos conseils et suggestions pour améliorer la structure de mon code, notamment en utilisant efficacement la structure conditionnelle (structure de cas) de LabVIEW.
Je vous remercie d'avance pour toute l'aide que vous pourrez m'apporter.
03-30-2024 01:40 PM - edited 03-30-2024 01:43 PM
Hi Angeline,
@angeline1 wrote:Read the value of the potentiometer connected to Arduino from LabVIEW.If the value read is greater than or equal to 3, turn on an LED connected to pin 7 of the Arduino.
Otherwise, if the value is less than 3, turn on another LED connected to pin 8 of the Arduino.
Being a beginner, I am asking for your advice and suggestions to improve the structure of my code, in particular by using the LabVIEW case structure effectively.
You only switch pin 7 inside the case structure, but you don't switch pin 8 in your VI.
And it seems you don't switch off pin7/8 when the condition is NOT matched…
03-30-2024 05:45 PM
First of all, I would like to thank you for your attention to my request.
I noticed that my program works efficiently as long as the threshold is lower than 3. It manages to acquire the signal from the potentiometer without any problem. However, as soon as the signal becomes greater than 3, a malfunction occurs and an error message is displayed.
After looking at the code, I suspect there is an error within the control structure (case/switch). Unfortunately, I have not yet managed to correct it, being still in the training phase.
I would be grateful if you could help me resolve this situation. Any suggestions or advice would be greatly appreciated.
03-30-2024 05:46 PM
First of all, I would like to thank you for your attention to my request.
I noticed that my program works efficiently as long as the threshold is lower than 3. It manages to acquire the signal from the potentiometer without any problem. However, as soon as the signal becomes greater than 3, a malfunction occurs and an error message is displayed.
After looking at the code, I suspect there is an error within the control structure (case/switch). Unfortunately, I have not yet managed to correct it, being still in the training phase.
I would be grateful if you could help me resolve this situation. Any suggestions or advice would be greatly appreciated.
03-31-2024 04:07 PM - edited 03-31-2024 04:09 PM
Hi angeline,
the error message is quite clear: your hardware doesn't support the requested feature! (Or the LINX software doesn't support your hardware with all its features.)
There is no problem with the case structure in LabVIEW.
04-01-2024 09:13 AM
if the code is still like the fist message, then your are missing a wire inside the case structure to indicate the LInx device.
04-01-2024 05:22 PM
Hi,
It worked, thank you. I just forgot to connect the wire, thanks for your help.