Arduino Libraries | Arduino Compatible Compiler for LabVIEW Discussions | Forum

Avatar
Please consider registering
guest
sp_LogInOut Log In sp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSS sp_TopicIcon
Arduino Libraries
February 11, 2018
4:11 pm
Avatar
manuwestern
New Member
Members
Forum Posts: 2
Member Since:
February 10, 2018
sp_UserOfflineSmall Offline

Hello,

I have ported some Arduino libraries to LabVIEW, but i have still some problems. One example: I create a timer-instance (my Arduino library) in the mainVI. Later i want to read out the timer value inside a subVI, so i need to refer to the timer instance that i previously created in the mainVI. In that situation the arduino compiler reports me that i want to call methods of an instance (inside the SubVI) that do not exist. If i put the code from the subVI into my mainVI everything works fine. What is the best way to handle this problem, because i don‘t want to put all the code inside my mainVI for reasons of clarity?

Another question: 

I want to use an interrupt handling library in LabVIEW. Some functions of this library needs a callback-function as argument. How can i use this library in LabVIEW?

Thanks for your help and i am sorry for my bad english.

Manuel

February 13, 2018
5:39 am
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Without seeing your library it is tough to see what you are trying to do but what you generally need to do is create your timer object dynamically in something like an Initialize VI which you pass in and index.  That index is used in your subVIs to reference the index of the timer object.  You would need to create a global variable which holds a pointer to the object.  I believe the Servo addon referenced here may be exactly what you are trying to do.  Take a look at it.

https://www.geverywhere.com/for.....-instance/

As far as interrupts, they are already natively supported in the Compiler.  There is a timer interrupt and GPIO interrupt example that show how to implement callbacks.  Take a look at the included examples under "Interrupts".

February 16, 2018
10:06 am
Avatar
manuwestern
New Member
Members
Forum Posts: 2
Member Since:
February 10, 2018
sp_UserOfflineSmall Offline

Hi, thank you. I had to use a global variable, to refer on my instance inside the sub-vi, now it works.

Another question, i have a function like that, it needs a callback-function as input.

How can i connect the callback-function to an callback-vi (onButtonChange)?

How do i have to create the Arduino Library Wrapper in LabVIEW?

 

Thanks, Manuel!

ButtonDebounce button(3, 250); // PIN 3 with 250ms debounce time
button.setCallback(onButtonChange);
February 16, 2018
5:52 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

The only callbacks that are supported are through the native Interrupt handler in the compiler.  You can do this by using Attach Interrupt.vi.    Take a look at the example called "Interrupt - On Digital Input Edge.vi".

Forum Timezone: UTC 0
Most Users Ever Online: 100
Currently Online:
30
Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
miche91: 33
scottj: 28
scadao: 23
Member Stats:
Guest Posters: 5
Members: 202
Moderators: 0
Admins: 3
Forum Stats:
Groups: 1
Forums: 2
Topics: 266
Posts: 1222
Newest Members:
pujacontrol
Administrators: geadmin: 22, filipealtoe: 96, Steffan: 356