This library allows you to connect Lego EV3 sensors to arduino using adapter board.
For more information about this library please visit us at http://.sk
Lists all available I2C devices.
listDevices()
Inicialisation function for setting up I2C and Serial port.
begin(long baudrate,int time)
baudrate: 300
, 1200
, 2400
, 4800
, 9600
, 19200
, 38400
, 57600
, 74880
, 115200
- sets baudrate of Serial port
time: 1
- 1000
- sets time of Serial timeout in ms
Functions that allows you to set I2C addresses of individual modules using Serial monitor.
setAddress()
Inicialisation function for setting up I2C and Serial port.
setMode(int address,String mode)
address: 0x04
- 0x77
- I2C address of module where mode will be set
mode: Off
, LightB
, LightR
, Color
- sets the mode of operation for sensors
Reads the value from sensor.
readData(int address,String mode)
address: 0x04
- 0x77
- I2C address of module where mode will be set
Value | State |
---|---|
1 | Pressed |
0 | Not pressed |
Value | Color name |
---|---|
0 | No color |
1 | Black |
2 | Blue |
3 | Green |
4 | Yellow |
5 | Red |
6 | White |
7 | Brown |
Copyright © 2020 Stanislav Jochman. All right reserved.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.