Merge pull request #18 from claws/add_ci

add ci
This commit is contained in:
claws
2017-08-27 17:13:33 +09:30
committed by GitHub
2 changed files with 75 additions and 4 deletions
+27
View File
@@ -0,0 +1,27 @@
language: cpp
env:
global:
- ARDUINO_PACKAGE_VERSION=1.8.4
- DISPLAY=:1.0
before_install:
# arduino requires an X server even with command line
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/xvfb_$TRAVIS_JOB_NUMBER.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
install:
- wget -q -O- http://downloads.arduino.cc/arduino-$ARDUINO_PACKAGE_VERSION-linux64.tar.xz | tar -Jxf -
- sudo mv arduino-$ARDUINO_PACKAGE_VERSION /usr/local/share/arduino
- sudo ln -s /usr/local/share/arduino/arduino /usr/local/bin/arduino
# Add esp8266 board support
# - arduino --pref "boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json" --save-prefs
# - arduino --install-boards esp8266:esp8266
# link project directory into Arduino libraries area.
- ln -s $PWD /usr/local/share/arduino/libraries/BH1750
script:
# uno
- arduino --verify --board arduino:avr:uno $PWD/examples/BH1750test/BH1750test.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/BH1750advanced/BH1750advanced.ino
# esp8266
# - arduino --verify --board esp8266:esp8266:generic $PWD/examples/BH1570test/BH1750test.ino
# - arduino --verify --board esp8266:esp8266:generic $PWD/examples/BH1570advanced/BH1750advanced.ino
+48 -4
View File
@@ -1,5 +1,6 @@
BH1750
==========
# BH1750
[![Build Status](https://travis-ci.org/claws/BH1750.svg?branch=master)](https://travis-ci.org/claws/BH1750)<br>
An Arduino library for digital light sensor breakout boards containing the BH1750FVI IC.
@@ -7,10 +8,53 @@ The board uses I2C for communication, and two pins are required to interface to
Datasheet can be obtained [here](http://rohmfs.rohm.com/en/products/databook/datasheet/ic/sensor/light/bh1750fvi-e.pdf)
The BH1750 had six different measurment modes. They are divided in two groups;
continuous and one-time measurments. In continuous mode, the sensor continuously
measures lightness value. In one-time mode, sensor makes only one measurment, and
then goes into Power Down mode after this.
Each mode, has three different precisions:
- Low Resolution Mode - (4 lx precision, 16ms measurment time)
- High Resolution Mode - (1 lx precision, 120ms measurment time)
- High Resolution Mode 2 - (0.5 lx precision, 120ms measurment time)
By default, this library uses Continuous High Resolution Mode, but you can set
any other mode by definepassing the mode argument to BH1750.begin().
Remember, if you use One-Time mode, your sensor will go to Power Down mode
each time, when it completes measurment and you've read it.
Typical Connection:
- VCC -> 5V (3V3 on Arduino Due, Zero, MKR1000, etc)
- GND -> GND
- SCL -> SCL (A5 on Arduino Uno, Leonardo, etc or 21 on Mega and Due on esp8266 free selectable)
- SDA -> SDA (A4 on Arduino Uno, Leonardo, etc or 20 on Mega and Due on esp8266 free selectable)
- ADD -> GND or VCC (see below)
ADD pin is used to set sensor I2C address. If it has voltage greater or equal to
0.7VCC voltage (e.g. you've connected it to VCC) the sensor address will be
0x5C. In other case (if ADD voltage less than 0.7 * VCC) the sensor address will
be 0x23 (by default).
## Installation
Click "Clone or download" -> "Download ZIP" button.
- **(For Arduino < 1.5.x)** Extract the archive to ``<Your User Directory>/My Documents/Arduino/libraries/`` folder and rename it to `BH1750`. Restart IDE.
- **(For Arduino >= 1.5.x)** Use the way above, or Library Manager. Open Arduino IDE, click `Sketch -> Include library -> Add .ZIP library ` and select the downloaded archive.
- **(For Arduino >= 1.5.x)** Use the way above, or Library Manager. Open Arduino
IDE, click `Sketch -> Include library -> Add .ZIP library ` and select the
downloaded archive.
- **(For Arduino < 1.5.x)** Extract the archive to
``<Your User Directory>/My Documents/Arduino/libraries/`` folder and rename it
to `BH1750`. Restart IDE.
Additional info, about library installation process - https://www.arduino.cc/en/Guide/Libraries
## Examples
There are two examples in the examples directory. One shows a simple use while
the other shows a more advanced use case.