10-19-2020 07:25 AM
I have written code which was supposed to work as a LINX custom command on Arduino and LabVIEW. The aim of the code was to take the input in integers from labview, multiply it by 100, and then use the product as a delay in blinking the on board Arduino Uno LED at pin 13 on and off. The code is as follows:
/****************************************************************************************
** This is example LINX firmware for use with the Arduino Uno with the serial
** interface enabled.
**
** For more information see: www.labviewmakerhub.com/linx
** For support visit the forums at: www.labviewmakerhub.com/forums/linx
**
** Written By Sam Kristoff
**
** BSD2 License.
****************************************************************************************/
//Include All Peripheral Libraries Used By LINX
#include <SPI.h>
#include <Wire.h>
#include <EEPROM.h>
#include <Servo.h>
//Include Device Specific Header From Sketch>>Import Library (In This Case LinxChipkitMax32.h)
//Also Include Desired LINX Listener From Sketch>>Import Library (In This Case LinxSerialListener.h)
#include <LinxArduinoUno.h>
#include <LinxSerialListener.h>
//Create A Pointer To The LINX Device Object We Instantiate In Setup()
LinxArduinoUno* LinxDevice;
int del=10;
//Initialize LINX Device And Listener
void setup()
{
pinMode(13,OUTPUT);
int blinktest(unsigned char numInputBytes, unsigned char* input, unsigned char* numResponseBytes, unsigned char* response);
//Instantiate The LINX Device
LinxDevice = new LinxArduinoUno();
//The LINXT Listener Is Pre Instantiated, Call Start And Pass A Pointer To The LINX Device And The UART Channel To Listen On
LinxSerialConnection.Start(LinxDevice, 0);
}
void loop()
{
//Listen For New Packets From LabVIEW
LinxSerialConnection.CheckForCommands();
//Your Code Here, But It will Slow Down The Connection With LabVIEW
}
int blinktest(unsigned char numInputBytes, unsigned char* input, unsigned char* numResponseBytes, unsigned char* response)
{
del=input;
del=del*100;
digitalWrite(13,HIGH);
delay(del);
digitalWrite(13,LOW);
delay(del);
return 0;
}
This code has been uploaded to Arduino. The other LabVIEW VI I have uploaded as well as the screenshots. Any guidance would be greatly appreciated.
Solved! Go to Solution.
10-19-2020 07:35 AM
Hi Umerator,
@TheUmerator wrote:
I have written code which was supposed to work as a LINX custom command on Arduino and LabVIEW.
…
Any guidance would be greatly appreciated.
"Any guidance" on what problem?
There is no question in your whole message!
05-08-2023 05:03 PM
I can not get the Arduino code to compile. I have rounded up all the .h & .ccp files. the code will just not compile to use. bummer.
05-17-2023 06:02 AM
Hey, thanks for giving it a try anyway, I ended up using a different medium than LabVIEW that suited my goals better at the time. Outdated libraries and whatnot. Thanks again!