Skip to content

Commit

Permalink
added delay
Browse files Browse the repository at this point in the history
  • Loading branch information
ladyada committed Apr 17, 2012
1 parent d939229 commit 445f1f4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions vcnl4000.pde
@@ -1,7 +1,21 @@
// Example sketch for talking to the VCNL4000 i2c proximity/light sensor
// Written by Adafruit! Public domain.
// To use: Connect VCC to 3.3-5V (5V is best if it is available), GND to
// ground, SCL to i2c clock (on classic arduinos, Analog 5), SDA
// to i2c data (on classic arduinos Analog 4). The 3.3v pin is
// an ouptut if you need 3.3V
// This sensor is 5V compliant so you can use it with 3.3 or 5V micros

// You can pick one up at the Adafruit shop: www.adafruit.com/products/466



#include <Wire.h>

// the i2c address
#define VCNL4000_ADDRESS 0x13

// commands and constants
#define VCNL4000_COMMAND 0x80
#define VCNL4000_PRODUCTID 0x81
#define VCNL4000_IRLED 0x83
Expand Down Expand Up @@ -102,6 +116,8 @@ uint8_t read8(uint8_t address)
Wire.send(address);
Wire.endTransmission();

delayMicroseconds(170); // delay required

Wire.requestFrom(VCNL4000_ADDRESS, 1);
while(!Wire.available());

Expand Down

0 comments on commit 445f1f4

Please sign in to comment.