LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Equivalent labveiw sketch to this arduino code **URGENT**

PLEASE HELP ~

STUDENT PROJECT ~

Can i please have the equivelanet labview code for this

/*

Sample code for the BH1750 Light sensor

website:www.elecrow.com

Connection:

VCC-5v

GND-GND

SCL-SCL(analog pin 5)

SDA-SDA(analog pin 4)

ADD-NC or GND

*/ 

#include <Wire.h> //BH1750 IIC Mode

#include <math.h>

int BH1750address = 0x23; //setting i2c address

byte buff[2];

void setup()

{

  Wire.begin();

  Serial.begin(57600);//init Serail band rate

}

void loop()

{

  int i;

  uint16_t val=0;

  BH1750_Init(BH1750address);

  delay(200); delay(150);

}

int BH1750_Read(int address) //

{

  int i=0;

  Wire.beginTransmission(address);

  Wire.requestFrom(address, 2);

  while(Wire.available()) //

  {

    buff = Wire.read();  // receive one byte

    i++;

  }

  Wire.endTransmission(); 

  return i;

}

void BH1750_Init(int address)

{

  Wire.beginTransmission(address);

  Wire.write(0x10);//1lx reolution 120ms

  Wire.endTransmission();

}

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

You can easily implement I2C communication via Arduino with LIFA or LINX.  LINX is the only interface that is being actively supported so I would recommend using it over LIFA.  You can look at the several libraries that I've created in the Documents section for how to use I2C functions.  Using LINX should be essentially the same as LIFA.

Message 2 of 5
(4,035 Views)

thanks for ur reply ..

can i please know where are the libraries ?

thanks

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

You can find my libraries in the documents section.

0 Kudos
Message 4 of 5
(4,035 Views)

Hello, 

 

Even though, 

 

I know how to use this equivalency in arduino, I need this same work that has to be done in the labview, for me it is difficult to include the BH1750.cpp and header file in the LIFA BASE.

 

 

Please help me to sort out this. 

 

I don't know how to include the address for initiating the I2C scan in labview. 

 

 

If you have any reference file. Please include. 

 

Thanks in advance. 

 

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