LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cant make it work (labview, visa + arduino, ds18d20)

hi guys, i've been reading a lot of post on how to make it work, but still i cant make a full duplex com betwen the arduino and labview.

since my english is quite poor, i'll talk through images :3

ARDUINO SIDE

 

void loop(void)
{
  if (Serial.available()) {
    String serial_input_01  = Serial.readStringUntil(serial_input_separator);
    Serial.read();
    String serial_input_02 = Serial.readStringUntil(serial_input_separator);
    Serial.read();
    String serial_input_03  = Serial.readStringUntil(serial_input_separator);
    Serial.read();
    String serial_input_04  = Serial.readStringUntil(serial_input_terminator);
    Serial.read();
    int input_01 = serial_input_01.toInt();
    int input_02 = serial_input_02.toInt();
    int input_03 = serial_input_03.toInt();
    int input_04 = serial_input_04.toInt();

switch (input_01) {
      case 1:
        if (input_02 == 1) {
          digitalWrite(7, LOW);
        }
        if (input_02 == 2){
          digitalWrite(7, HIGH);
        }
        break;}

if i write in the serial monitor from the arduino 01,01 and hit enter digital write(7) turns off, if i write 01,02 turns on, so i guess it works right? if i wirte for instance 02,###,###,### i set the colors of an rgb led.

 

after the switch case structure:

 

 sensors.requestTemperatures();
  Serial.print("A");
  Serial.println(sensors.getTempCByIndex(0));

  int potValue = map(analogRead(potPin), 0, 1023, 0, 100);
  Serial.print("B");
  Serial.println(potValue, DEC);

  delay(250);
} // end loop

 

as you can see arduino send every loop the values of the bs18d20 and the pot 
A##.##
B###serial monitorserial monitorLABVIEW SIDEit works reading (taller.vi)it works reading (taller.vi)

 

so finally i add a switch and a visa write, but then the program does not recieve nor send a thing (and doesnt give any error)

taller-02.vitaller-02.vi

taller.vi only reads

taller-02.vi try to write

so this is it guys, i really dont know what i'm doing wrong and it's driving me crazy, any help would be appreciated... PLEASE HELP! u.u

0 Kudos
Message 1 of 5
(2,859 Views)

FIX

i'm srry guys taller-02.vi was a wrong file, here is the current try-to-write file, with a little improvement
what do you think?what do you think?

 

 

 

0 Kudos
Message 2 of 5
(2,792 Views)

Remove "Bytes at port", it is not used when reading a line with a terminal symbol (carriage return). Instead of this function, put a constant, for example 100.
Check what actions Arduino performs when receiving the package. What he does if the package is wrong. Make sure that Arduino correctly accepts the parcel.

Labview 4.0, 5.0, 6.1, 8.6, 2009, 2011, 2012, 2014
If you do not know something, ask me.
Message 3 of 5
(2,782 Views)

thank you for your answer Borjomy this is how arduino behaves with diferent inputsthis is how arduino behaves with diferent inputs

in the labview side there is an improvement after deleting the bytes at port, for that i cant thank you enough! 

so after watching for a moment this is what i read in the read buffer

debug:
number1: 1       
number2: 101
number3: 101
number4: 101
A##
B## 

after moving the bool swtich

debug:
number1: 1       
number2: 201
number3: 201
number4: 201
A##
B## 

again thank you! 

i guess is about how i'm sending the strings to the arduino.

--edit--

after a few test i did in serial monitor, this is what arduino is receiving for each state of the boolean switch

01,0101,0101,0101.. or 1,0101,0101,0101

02,0202,0202,0202... or 2,0202,0202,0202...

if i enter 1,101,101,101 

arduino responds with 

Debug: 
number1: 1
number2: 1
number3: 1
number4: 1

 

0 Kudos
Message 4 of 5
(2,773 Views)

solution attached

0 Kudos
Message 5 of 5
(2,748 Views)