From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

LABVIEW SENSUINO EC PROBE

Hello,

I am a newbie and have had some success with LIFA.  I am trying to get EC readings using the Senduino EC probe but can't quiet figure it out.  I would apprecitate any help.  If someone could point me in the right direction I will crunch awat. I posted the sketch.   Thx in advance.

#define SAMPLES 100

#define ECinputPIN 6

#define enablePIN 7

void setup() {

pinMode(ECinputPIN ,INPUT);

pinMode(enablePIN ,OUTPUT);

Serial.begin(9600);

}

float ECa=1;

float ECb=1;

long highPulseTime;

long lowPulseTime;

void loop() {

digitalWrite(enablePIN ,HIGH);

delay(100);

lowPulseTime=getLow(ECinputPIN);

Serial.print(lowPulseTime);

Serial.print("    ");

highPulseTime=getHigh(ECinputPIN);

digitalWrite(enablePIN ,LOW);

Serial.print(highPulseTime);

Serial.print("    ");

Serial.println(lowPulseTime+highPulseTime);

delay(2000);

}

long getHigh(int pin) {

long pulseTime=0;

for(unsigned int j=0; j<SAMPLES; j++){

pulseTime+=pulseIn(pin, HIGH);

}

pulseTime= pulseTime/SAMPLES;

return pulseTime;

}

long getLow(int pin) {

long pulseTime=0;

for(unsigned int j=0; j<SAMPLES; j++){

pulseTime+=pulseIn(pin, LOW);

}

pulseTime = pulseTime/SAMPLES;

return pulseTime;

}

0 Kudos
Message 1 of 5
(4,793 Views)

If the code that you posted is accurate, you will not be able to use the sensor with LIFA because LIFA does not provide the capability to use the pulseIn() function.

Also, since LIFA is no longer being developed and is very old, you should consider using LINX.  You will still probably need to request for someone to make support for the sensor but there is more activity for LINX.  If you do post, please post a link to the datasheet for the sensor you are using.

0 Kudos
Message 2 of 5
(3,095 Views)

Thanks Nathan. You have taught me a lot onhere.  Thank you for all your work!!  I will get LINX and repost. 

0 Kudos
Message 3 of 5
(3,095 Views)

I use Read pulse width in LINX toolkit, works perfect.

0 Kudos
Message 4 of 5
(3,095 Views)

Awesome, that is great to hear.

0 Kudos
Message 5 of 5
(3,095 Views)