Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 1 of 1

Thread: BH1750 Light Sensor and Teensy 3.2 compatible?

  1. #1
    Junior Member
    Join Date
    Feb 2020
    Posts
    10

    BH1750 Light Sensor and Teensy 3.2 compatible?

    I am getting a response from the sensor but it is an erroneous number and not a true sensor reading. I believe this is because there is something wrong with my wiring.

    I have the SDA pin of the sensor going to Pin 18 and SCL going to Pin 19 on the Teensy 3.2

    Code:
    #define HWSERIAL Serial1
    #include <MFRC522.h>
    #include <SPI.h>
    #include <Wire.h>
    #include "BH1750FVI.h"
    
    BH1750FVI LightSensor;
    
    void setup() {
      HWSERIAL.begin(9600);
      LightSensor.begin();
      LightSensor.SetAddress(0x5C);
      LightSensor.SetMode(Continuous_H_resolution_Mode);
    }
    
    void loop() {
      
      uint16_t lux = LightSensor.GetLightIntensity();
      HWSERIAL.print("Lux = ");HWSERIAL.print(lux);
      
    }
    Last edited by colinodowd; 02-04-2020 at 05:41 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •