26 lines
651 B
C++
26 lines
651 B
C++
// Suche in Arduino Libraries nach TSL2591 und installiere Adafruit TSL2591
|
|
// kopiere in die jeweils entsprechenden Funktionen in ui.ino
|
|
|
|
#include <Wire.h>
|
|
#include <Adafruit_Sensor.h>
|
|
#include "Adafruit_TSL2591.h"
|
|
|
|
Adafruit_TSL2591 tsl = Adafruit_TSL2591(2591);
|
|
|
|
void setup(){
|
|
tsl.begin()
|
|
tsl.setGain(TSL2591_GAIN_MED);
|
|
tsl.setTiming(TSL2591_INTEGRATIONTIME_100MS);
|
|
}
|
|
|
|
void loop(){
|
|
int lux = tsl.getLuminosity(TSL2591_VISIBLE);
|
|
|
|
// Label (oder andere Text-Elemente)
|
|
lv_label_set_text(ui_Label1, String(lux).c_str());
|
|
|
|
// Bar / Arc (alles mit Werten)
|
|
lv_bar_set_value(ui_Bar1, lux, LV_ANIM_ON); // oder LV_ANIM_OFF
|
|
}
|
|
|