Rohm / BH1749NUC

Dependents:   rohm-SensorShield-example

Embed: (wiki syntax)

« Back to documentation index

BH1749NUC Class Reference

BH1749NUC Class Reference

Interface for controlling BME280 Combined humidity and pressure sensor. More...

#include <BH1749NUC.h>

Public Member Functions

 BH1749NUC (PinName sda, PinName scl, int addr=BH1749NUC_DEVICE_ADDRESS_39)
 Create a BH1749NUC instance which is connected to specified I2C pins with specified address.
 ~BH1749NUC ()
 BH1749NUC destructor.
int init (void)
 Initialize BH1749NUC device.
int get_rawval (char *data)
 Get color sensor raw value.
int get_val (unsigned short *data)
 Get color sensor value.

Detailed Description

Interface for controlling BME280 Combined humidity and pressure sensor.

 #include "mbed.h"
 #include "BH1749NUC.h"
 
 BH1749NUC color(I2C_SDA, I2C_SCL);
 
 int main(void) {
     uint16_t buf[5];
     color.init();
  
     while (1) {
         color.get_val(buf);
         printf("BH1749 color : [R] %04x, [G] %04x, [B] %04x, [IR] %04x, [G2] %04x\n", buf[0], buf[1], buf[2], buf[3], buf[4]);
         wait(1);
     }
 }

BH1749NUC class

BH1749NUC: A library to correct color data using Rohm BH1749NUC color sensor device

Definition at line 87 of file BH1749NUC.h.


Constructor & Destructor Documentation

BH1749NUC ( PinName  sda,
PinName  scl,
int  addr = BH1749NUC_DEVICE_ADDRESS_39 
)

Create a BH1749NUC instance which is connected to specified I2C pins with specified address.

Parameters:
sdaI2C-bus SDA pin
sdlI2C-bus SCL pin
addrslave address of the I2C peripheral (default: 0x72)

Definition at line 27 of file BH1749NUC.cpp.

~BH1749NUC (  )

BH1749NUC destructor.

Definition at line 31 of file BH1749NUC.cpp.


Member Function Documentation

int get_rawval ( char *  data )

Get color sensor raw value.

Parameters:
databuffer to store raw data

Definition at line 84 of file BH1749NUC.cpp.

int get_val ( unsigned short *  data )

Get color sensor value.

Parameters:
databuffer to store sensor data (R, B, G, IR and G2)

Definition at line 96 of file BH1749NUC.cpp.

int init ( void   )

Initialize BH1749NUC device.

Definition at line 36 of file BH1749NUC.cpp.