LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with a little program labVIEW+Arduino

Hi! I'm having troubles with this little program and cannot find a solution, anyone have a clue?

 

So it's really simple, I just have an arduino with a button and I want labview to read that data and store an image whenever that button is pressed

The arduino program is this one

 

int boton=2;

void setup() {
  pinMode(boton, INPUT);
  Serial.begin(9600);
}

void loop() {
 if(digitalRead(boton)==HIGH)
 Serial.println("1");

delay(200);
  }



And the labVIEW connections are this:
Zuzguluddi_1-1746559083892.png


The arduino works perfect, just sends the ''1'' character to serial monitor in the IDE. But the trouble is that the case structure never gets a true value... If anyone could provide help I'll very much appreciate it.
Thanks!

0 Kudos
Message 1 of 3
(152 Views)

I see you are using "Bytes at Port", I suggest you watch this video: VIWeek 2020/Proper way to communicate over serial

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 3
(134 Views)

Hi Zuz,

 


@Zuzguluddi wrote:

The arduino program is this one

 

int boton=2;

void setup() {
  pinMode(boton, INPUT);
  Serial.begin(9600);
}

void loop() {
 if(digitalRead(boton)==HIGH)
 Serial.println("1");

delay(200);
  }

So your Arduino only sends "1\n". And it sends that string only when the button is "HIGH"…

 

I recommend to send "0\n" additionally when the button is "LOW". Otherwise the message receiver need to handle timeout errors to detect the 2nd button state!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 3
(94 Views)