/*********************************************************
*******
I2C_ZX_Demo.ino
XYZ Interactive ZX Sensor
Shawn Hymel @ SparkFun Electronics
May 6, 2015
https://github.com/sparkfun/SparkFun_ZX_Distance_and_Gestu
re_Sensor_Arduino_Library
Tests the ZX sensor's ability to read ZX data over I2C. Th
is demo
configures the ZX sensor and periodically polls for Zaxi
s and Xaxis data.
Hardware Connections:
Arduino Pin ZX Sensor Board Function
5V VCC Power
GND GND Ground
A4 DA I2C Data
A5 CL I2C Clock
Resources:
Include Wire.h and ZX_Sensor.h
Development environment specifics:
Written in Arduino 1.6.3
Tested with a SparkFun RedBoard
This code is beerware; if you see me (or any other SparkFu
n
employee) at the local, and you've found our code helpfu
l, please
buy us a round!
Distributed asis; no warranty is given.
**********************************************************
******/
#include <Wire.h>
#include <ZX_Sensor.h>
// Constants
const int ZX_ADDR = 0x10; // ZX Sensor I2C address
// Global Variables
ZX_Sensor zx_sensor = ZX_Sensor(ZX_ADDR);
uint8_t x_pos;
uint8_t z_pos;
void setup() {
uint8_t ver;
// Initialize Serial port
Serial.begin(9600);
Serial.println();
Serial.println("");
Serial.println("SparkFun/GestureSense I2C ZX Demo");
Serial.println("");
// Initialize ZX Sensor (configure I2C and read model I
D)
Page 7 of 16
Need help?
Do you have a question about the ZX Distance and Gesture Sensor and is the answer not in the manual?