Jump to content
43oh

Marvi

Members
  • Content Count

    2
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Marvi got a reaction from phaseform in Trouble with BH1750 (Tiva C-Lm4f123gxl)   
    I tested BH1750FVI board for arduino and it works. But there is few things I have to do before It worked. On the board is 3.3V voltage stabilizer, so you must remove it or use 5V from USB and common ground with microprocessor!  I make few changes in code. Energia 0014 and Launchpad 1.4 (cross RX TX) with MSP430G2553. Here is my working code:
    // SDA to PIN 1.7 //SCL to PIN 1.6 //The iic address = 0x23 when ADDR = LOW; address = 0x3C when ADDR = HIGH #include <Wire.h> //BH1750 I2C Mode slave uint16_t Lux=0; void setup() { Wire.begin(); Serial.begin(9600); } void loop() { Lux=0; Read_BH1750(); Serial.print(Lux,DEC); Serial.println(" LUX"); delay(400); } void Read_BH1750() { byte buff[2]; int i=0; Wire.beginTransmission(0x23); Wire.write(0x10);//1 Lux resolution time 120ms Wire.requestFrom(0x23, 2 ); while(Wire.available()){buff[i] = Wire.read(); i++;} // receive one byte Wire.endTransmission(); if(i==2){Lux=((buff[0]<<8)|buff[1])/(12/10);} }
×
×
  • Create New...