Ciao
Sto litigando con un AS7263 della Sparkfun:
ho letto datasheet, le relative librerie ma ci sono cose che non comprendo.
Nel datasheet si parla di registri virtuali per lettura e scrittura, trovo queste indicazioni nelle librerie, ma non capisco come funzionano.
Nelle librerie vedo che uno stesso indirizzoviene attribuito a due variabili diverse.
Per esempio:
#define AS726x_DEVICE_TYPE 0x00
#define AS726x_HW_VERSION 0x01
#define AS726x_CONTROL_SETUP 0x04
#define AS726x_INT_T 0x05
#define AS726x_DEVICE_TEMP 0x06
#define AS726x_LED_CONTROL 0x07
#define AS72XX_SLAVE_STATUS_REG 0x00
#define AS72XX_SLAVE_WRITE_REG 0x01
Questo lo sketch:
/*
This is a library written for the AS726X Spectral Sensor (Visible or IR) with I2C firmware
specially loaded. SparkFun sells these at its website: www.sparkfun.com
Written by Nathan Seidle & Andrew England @ SparkFun Electronics, July 12th, 2017
https://github.com/sparkfun/Qwiic_Spectral_Sensor_AS726X
Do you like this library? Help support SparkFun. Buy a board!
Development environment specifics:
Arduino IDE 1.8.1
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AS726X.h"
AS726X sensor;//Creates the sensor object
byte GAIN = 2;
byte MEASUREMENT_MODE = 0;
void setup() {
sensor.begin(Wire, GAIN, MEASUREMENT_MODE);
}
void loop() {
sensor.takeMeasurementsWithBulb();
sensor.printMeasurements();
}
AS726X.cpp (14.3 KB)
AS726X.h (3.21 KB)