Community
cancel
Showing results for 
Search instead for 
Did you mean: 
KSels
New Contributor II
2,273 Views

i2c read/write

Jump to solution

I got a Device in i2c 1 at 0x48. (ADS1115)

I want a simple JavaScript, Python and c# /c++ code to Write to and Read from this 16bit Device.

How do I do this?

Tags (2)
1 Solution
Diego_V_Intel
Employee
100 Views

Hi KimLorentz,

From your other thread , I see that you were able to run the example code for your device. I recommend you to check the methods available in the ADS1115 library and make the necessary modifications in the example code to include the methods you need to write to and read from the device. A list of each method and a description of each one can be checked in the following site: http://iotdk.intel.com/docs/master/upm/classupm_1_1_a_d_s1_x15.html# a9c6e3d6c40e46aa5362ba777517e91af upm: ADS1X15 Class Reference

I hope this information helps you.

Regards,

Diego

View solution in original post

5 Replies
Diego_V_Intel
Employee
101 Views

Hi KimLorentz,

From your other thread , I see that you were able to run the example code for your device. I recommend you to check the methods available in the ADS1115 library and make the necessary modifications in the example code to include the methods you need to write to and read from the device. A list of each method and a description of each one can be checked in the following site: http://iotdk.intel.com/docs/master/upm/classupm_1_1_a_d_s1_x15.html# a9c6e3d6c40e46aa5362ba777517e91af upm: ADS1X15 Class Reference

I hope this information helps you.

Regards,

Diego

View solution in original post

KSels
New Contributor II
100 Views

Tnx for the link. I am trying to edit the settings on the ADS1115 with the use of the library.

On this thread I want to communicate to i2c devices without using an library.

I have several i2c devices like ina219, ADXL345, LSM303DLHC, ADS1015 and LSM9DS0.

Diego_V_Intel
Employee
100 Views

Hi KimLorentz,

Since you have different I2C devices, I would suggest you to look for each sensor in the UPM Supported Sensors list, hopefully there is a library for each sensor: http://iotdk.intel.com/docs/master/upm/modules.html upm: UPM Libraries

On the other hand, considering the fact that you don't want to use any sensor library, I would recommend you to check directly the MRAA library to know the details about the I2C interface use. This way you will be using the I2C read and write methods that are used in each sensor library. The information about the MRAA library can be checked in the following site:

https://github.com/intel-iot-devkit/mraa GitHub - intel-iot-devkit/mraa: Low Level Skeleton Library for IO Communication on GNU/Linux platforms

Also, I recommend you to check the API documentation for the programming language you prefer: https://github.com/intel-iot-devkit/mraa# api-documentation GitHub - intel-iot-devkit/mraa: Low Level Skeleton Library for IO Communication on GNU/Linux platforms

Regards,

Diego

KSels
New Contributor II
100 Views

I am not able to find out how to send commands.

Do you have an example of sending setGain command?

Diego_V_Intel
Employee
100 Views

Hi KimLorentz,

The setGain() method accepts the following values:

  • "GAIN_TWOTHIRDS" for 6.144V
  • "GAIN_ONE" for 4.096V
  • "GAIN_TWO" for 2.048V
  • "GAIN_FOUR" for 1.024V
  • "GAIN_EIGHT" for 0.512V
  • "GAIN_SIXTEEN" for 0.256V

I took the information above from the ads1x15.h file: https://github.com/intel-iot-devkit/upm/blob/40be9b68a582fd1819887c5952a90911845b5828/src/ads1x15/ad... L129 upm/ads1x15.h at 40be9b68a582fd1819887c5952a90911845b5828 · intel-iot-devkit/upm · GitHub

An example code that uses the setGain() method can be found in the following site, I hope you find it useful: https://github.com/intel-iot-devkit/upm/blob/40be9b68a582fd1819887c5952a90911845b5828/examples/c%2B%... upm/ads1x15.cxx at 40be9b68a582fd1819887c5952a90911845b5828 · intel-iot-devkit/upm · GitHub

Regards,

Diego

Reply