05-05-2014 08:22 PM
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();
}
05-05-2014 11:17 PM
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.
05-06-2014 04:34 AM
thanks for ur reply ..
can i please know where are the libraries ?
thanks
05-06-2014 08:08 PM
You can find my libraries in the documents section.
12-15-2018 12:25 PM
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.