BH1750BVI Light Sensor Help

The bear

Senior Member
Hello Everyone,
Link to Jeremy Harris 05.03.13

http://www.picaxeforum.co.uk/showthread.php?23436-Anyone-used-a-BH1750BVI-light-sensor-with-a-Picaxe
Code:
	;BH1750BVI Light Sensor 03.12.17
	#Picaxe 08M2 ;98 Bytes
	#No_data
	;#Terminal 4800
	#Com 3
	
	Sertxd("BH1750BVI Light Sensor 08.12.17",13,10)
	Symbol baud = N2400
	Symbol oled = C.4
	Symbol scl = C.1
	Symbol sda = C.2
	Symbol lux1 = b1
	Symbol lux0 = b0
	;Symbol control = b2
	;Let control = %01000110
init:	
	 Hi2csetup I2cmaster, %01000110, I2cslow, I2cbyte ;ADD = Low
	 Pause 1000
Main:
	 Serout C.0, N2400, (254,1) ;Clear screen
Do
	 Hi2cout (%00010000)
	 Pause 1000
	  Hi2cin 0,(b1,b0 )
	; Sertxd (0, "  b1,b0    ",13,10)
	  Sertxd (0, "  w0    ",13,10)
	  Pause 1000
	  Serout C.4,baud,(254,203,"  w0  ")
Loop
http://http://pdf1.alldatasheet.com/datasheet-pdf/view/338083/ROHM/BH1750FVI.html

Any suggestions would be appreciated, not surprisingly there is no output. I'm still trying to learn about HI2C etc.

Regards, bear..
 

hippy

Technical Support
Staff member
Start simpler; don't try to output to an LCD, simply output to the Serial terminal -

Code:
#Picaxe 08M2
#Terminal 4800
Hi2csetup I2cmaster, %01000110, I2cslow, I2cbyte
Pause 1000
Do
  Hi2cout ( %00010000 )
  Pause 1000
  Hi2cin 0, ( b1, b0 )
  SerTxd( "w0 = ", #w0, CR, LF )
  Pause 1000
Loop
 

The bear

Senior Member
@ hippy,
Thank you, that's brilliant.
I threw in the LCD, in desperation.
Regards, bear..
 
Last edited:
Top