Trinket and VCNL4000 Proximity Sensor Problem

USB AVR Programmer and SPI interface. Adafruit's USBtinyISP.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
gp99
 
Posts: 3
Joined: Sun Jan 30, 2011 3:20 am

Trinket and VCNL4000 Proximity Sensor Problem

Post by gp99 »

Hi all,

I'm trying to run a VCNL4000 from a 3.3V Trinket. In the IDE, when I compile I get the following errors:

/Applications/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/libraries/Wire/utility/twi.c: In function 'twi_init':
/Applications/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/libraries/Wire/utility/twi.c:76: error: 'SDA' undeclared (first use in this function)
/Applications/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/libraries/Wire/utility/twi.c:76: error: (Each undeclared identifier is reported only once
/Applications/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/libraries/Wire/utility/twi.c:76: error: for each function it appears in.)
/Applications/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/libraries/Wire/utility/twi.c:77: error: 'SCL' undeclared (first use in this function)
/Applications/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/libraries/Wire/utility/twi.c:80: error: 'TWSR' undeclared (first use in this function)
/Applications/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/libraries/Wire/utility/twi.c:80: error: 'TWPS0' undeclared (first use in this function)
...


Not quite sure where SDA, SCL, etc. ought to have been declared or if we're just at a memory limit or something , but if someone can provide suggestions, much appreciated. Trinket is new territory.

Thanks.

User avatar
AnneBarela
Learn User Page
 
Posts: 757
Joined: Sat Mar 24, 2012 8:56 pm

Re: Trinket and VCNL4000 Proximity Sensor Problem

Post by AnneBarela »

The library you are trying to use for the sensor is for classic Arduinos and will not work for the ATtiny85 the Trinket is based on.

You can use the TinyWireM library instead of the Wire library (change the sensor library to call the TinyWireM library also). You can see the learn.adafruit.com tutorials that do this for other libraries.

User avatar
gp99
 
Posts: 3
Joined: Sun Jan 30, 2011 3:20 am

Re: Trinket and VCNL4000 Proximity Sensor Problem

Post by gp99 »

Thanks kindly! I'll give that a try.

Locked
Please be positive and constructive with your questions and comments.

Return to “USBtinyISP”