Raspberry Pi Pico DIY Light Meter Micropython sensor BH1750 (GY-302)
3 هزار بار بازدید -
3 سال پیش
-
#Raspberrypipico
#Raspberrypipico #Raspberrypico
Raspberry Pico project light meter Thonny Micropython
Light sensor BH1750 (GY-302) and OLED display SSD1306
Power bank Wemos battery shield 18650
I2C communication
Thonny IDE
Test code:
from machine import I2C, Pin
from BH1750 import BH1750
from ssd1306 import SSD1306_I2C
from time import sleep
i2c = I2C(0,sda=Pin(16), scl=Pin(17), freq=400000)
oled = SSD1306_I2C(128,64,i2c) ## Oled Display pixel size 128x64
oled.fill(0)
light = BH1750(i2c)
while True:
lux=light.luminance(BH1750.ONCE_HIRES_1) ## Sample luminance in lux
lux = str(round(lux, 1))
oled.fill(0)
oled.text("LUX",20,0)
oled.text(lux, 20,15)
oled.show()
sleep(0.5)
Raspberry Pico project light meter Thonny Micropython
Light sensor BH1750 (GY-302) and OLED display SSD1306
Power bank Wemos battery shield 18650
I2C communication
Thonny IDE
Test code:
from machine import I2C, Pin
from BH1750 import BH1750
from ssd1306 import SSD1306_I2C
from time import sleep
i2c = I2C(0,sda=Pin(16), scl=Pin(17), freq=400000)
oled = SSD1306_I2C(128,64,i2c) ## Oled Display pixel size 128x64
oled.fill(0)
light = BH1750(i2c)
while True:
lux=light.luminance(BH1750.ONCE_HIRES_1) ## Sample luminance in lux
lux = str(round(lux, 1))
oled.fill(0)
oled.text("LUX",20,0)
oled.text(lux, 20,15)
oled.show()
sleep(0.5)
3 سال پیش
در تاریخ 1400/01/18 منتشر شده
است.
3,029
بـار بازدید شده