TSL2561 how to get event.light

Hi there !

I want to replace my automatic projector that lights around my house to control them manually.

The principle is the same as that sold commercially but with the added possibility of keeping them either off or on.

For this I will use a motion sensor, two relays and a light sensor.

In the following sketch I am looking for how to retrieve the value in LUX even.light to use it in another loop, unfortunately I can’t.

Thank you to those who can help me

Charles

    #define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
//
//
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_TSL2561_U.h>
Adafruit_TSL2561_Unified tsl = Adafruit_TSL2561_Unified(TSL2561_ADDR_FLOAT, 12345);


int RelaisEclairage = 0;
//int (event.light) = luminosité;

//token 
char auth[] = "xx";
char ssid[] = "xx";
char pass[] = "xx";

BlynkTimer timer;


void setup()
{
  // Debug console
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass, "blynk-charles.ddns.net", 8080);
  //
   Serial.println("Light Sensor Test"); 
  Serial.println("");
  if(!tsl.begin())
  {
    Serial.print("No TSL2561 detected");
    while(1);
  }

  tsl.enableAutoRange(true);
  tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_13MS);

  sensors_event_t event;
  tsl.getEvent(&event);
  int (event.light);
 
  Serial.println("");

  timer.setInterval(1000L , Lux);
  //timer.setInterval(1000L , alimOn);


}


void loop()
{
  Blynk.run();
  timer.run();
} 

void Lux()

 {
   sensors_event_t event;
  tsl.getEvent(&event);
  /* Display the results (light is measured in lux) */
  if (event.light)
  {
    Serial.print(event.light); 
    Serial.println(" lux");
  }
  else
  {
    Serial.println("Sensor overload");
  }
  
  {
  Blynk.virtualWrite(V20, event.light);
  }
 }

Have you tried using a global variable?
For example:

Int LUX;

void Lux()

 {
   sensors_event_t event;
  tsl.getEvent(&event);
  /* Display the results (light is measured in lux) */
 LUX = event.light;
  {
    Serial.print(LUX); 
  }