Skip to content

A port of the (original) Adafruit Arduino driver for the TSL2561 Lux sensor

License

Notifications You must be signed in to change notification settings

pedalPusher68/arduino-adafruit-tsl2561

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino Adafruit TSL2561 library for Mongoose OS

This is a port of the Adafruit Arduino driver for the TSL2561 sensor ported to run on the Mongoose OS ecosystem.

Usage is extremely simple....

in mos.yml, add to libs: section,

- origin: https://github.com/pedalPusher68/arduino-adafruit-htu21df

in your init.js, add something like the following,

load('api_arduino_tsl2561.js');

and

//Initialize Adafruit_TSL2561 library
let tsl = Adafruit_TSL2561.create();
print('Adafruit_TSL2561.TSL2561_GAIN_16X -> ',Adafruit_TSL2561.TSL2561_GAIN_16X);
tsl.setGain(Adafruit_TSL2561.TSL2561_GAIN_16X);
tsl.setIntegrationTime(Adafruit_TSL2561.TSL2561_INTEGRATIONTIME_402MS);
tsl.begin();

let tslGetData = function() {
    let vis = tsl.getVisible();
    let ir = tsl.getInfrared();
    let lux = tsl.calculateLux(vis, ir);
    print('TSL2561:  Vis: ', vis ,', IR: ', ir, ', Lux: ',lux);
};

let tslTimer = Timer.set(10000 /* milliseconds */, true /* repeat */, tslGetData, null);

to use the library.

Enjoy!

About

A port of the (original) Adafruit Arduino driver for the TSL2561 Lux sensor

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •