キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

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 件の賞賛
メッセージ1/3
459件の閲覧回数

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 件の賞賛
メッセージ2/3
441件の閲覧回数

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 件の賞賛
メッセージ3/3
401件の閲覧回数