help I2C sensor interface
孫煒竣
Posts: 5
I'm a university student from TW
I original use Arduino
But now I use propeller Simple IDE
I use sensor: "sparkfun Line Follower Array" it's a Infrared sensor
he wants use "SparkFun_Line_Follower_Array_Arduino_Library-master" library in Arduino
but SimpleIDE can't include this library
so,i can't use
I know he use I2c interface
I Inquire "simpletools.h" have I2C function
but i well not ues this function
i2c_in ( i2c * busID,
int i2cAddr,
int memAddr,
int memAddrCount,
unsigned char * data,
int dataCount
)
so please help
I original use Arduino
But now I use propeller Simple IDE
I use sensor: "sparkfun Line Follower Array" it's a Infrared sensor
he wants use "SparkFun_Line_Follower_Array_Arduino_Library-master" library in Arduino
but SimpleIDE can't include this library
so,i can't use
I know he use I2c interface
I Inquire "simpletools.h" have I2C function
but i well not ues this function
i2c_in ( i2c * busID,
int i2cAddr,
int memAddr,
int memAddrCount,
unsigned char * data,
int dataCount
)
so please help
Comments
Being the author of PropWare, I am biased.
I would recommend using PropWare's I2C class to replace Arduino's "Wire" class. You will need to download the following files and place them in a folder named "PropWare" in your project's directory:
https://github.com/parallaxinc/PropWare/blob/release-2.0/PropWare/i2c.h
https://github.com/parallaxinc/PropWare/blob/release-2.0/PropWare/i2cbase.h
https://github.com/parallaxinc/PropWare/blob/release-2.0/PropWare/pin.h
https://github.com/parallaxinc/PropWare/blob/release-2.0/PropWare/port.h
https://github.com/parallaxinc/PropWare/blob/release-2.0/PropWare/PropWare.h
Once those files have been placed into your project, you can working through the Arduino code form SparkFun and replace instances of "Wire" with the special I2C class. I can help more with that part if you need it after I get home from work.
I do according to his,
you i2c.h and Web page download "PropWare" Folder's I2c like it?
According to him I could do?
so those files have been placed into my project , i from arduino code can no longer be set by,Able to use?
you say So mean?
Then I do according to the website is the representative I have to add files to my project yet
you say:" you can working through the Arduino code form SparkFun and replace instances of "Wire" with the special I2C class. "
I mentioned above mean that I add these files after my project will be able to use Arduino code to compile into the propeller is this mean?
re:I would like to ask you to say your interface files posted I2C.h told me to go to this page of the downloaded files inside the same file it I2C.h
1. In the I2C.h file it provided him a webpage and told him to downlown files
2. Then he was told to add files to his project.
3. Then he has to change the Arduino code form SparkFun and replace instances of "Wire" with the special I2C class.
4. The question is if he does that will he be able to use Arduino to compile into the Propeller (I'm not sure what this means)
The methods on PropWare::I2C are not identical to the Wire class, so it will take more than a "find and replace" to make it work, but hopefully it isn't too much work.