I'm pretty new to the hardware part of technology, been programming a while. Now I've got this sparkfun VCNL4000 connected (or trying to) to my spark core. (https://www.sparkfun.com/products/10901)
I've hooked it up as follows at the moment:
Where the vcnl ports are as follows:
1 = IR+
4 = SDA
5 = SCL
6 = GND
7 = 3.3v
I run the example code linked to from the spark website but it keeps hanging up on
The only other thing I can think of is that the 3.3v supply for the ir+ isn't enough, but the sparkfun website suggests anything between 2.5-5.5v or am I mis interpreting this? Or is that possibly not the problem at all.
As I said, I'm kind of lost of what it can be. Any ideas?
Wire.available() returns the number of bytes available to be read and I am not sure how your code is supposed to work. Are there supposed to be bytes to be read at the start of loop()? That would mean you are in the middle of an i2c read.
Does the call to initVCNL4000() succeed and print VNCL4000 Online…?
Yes the Arduino and the Spark are not exactly the same and the i2c library does not put the I/O pins into pull up mode when you are reading data, so you need two resistors around 4.7k ohm in value and you should connect them from the D0 and D1 pins to the 3V3 pin on the core.