GY-63_MS5611/libraries/AD5248
2024-04-13 10:35:57 +02:00
..
.github bulk update GitHub actions 2024-04-13 10:35:57 +02:00
examples 0.1.1 AD5248 2024-03-16 19:58:26 +01:00
test 0.1.1 AD5248 2024-03-16 19:58:26 +01:00
.arduino-ci.yml 0.1.0 AD5248 2023-12-27 17:07:56 +01:00
AD5248.cpp 0.1.1 AD5248 2024-03-16 19:58:26 +01:00
AD5248.h 0.1.1 AD5248 2024-03-16 19:58:26 +01:00
CHANGELOG.md 0.1.1 AD5248 2024-03-16 19:58:26 +01:00
keywords.txt 0.1.1 AD5248 2024-03-16 19:58:26 +01:00
library.json 0.1.1 AD5248 2024-03-16 19:58:26 +01:00
library.properties 0.1.1 AD5248 2024-03-16 19:58:26 +01:00
LICENSE 0.1.1 AD5248 2024-03-16 19:58:26 +01:00
README.md 0.1.1 AD5248 2024-03-16 19:58:26 +01:00

Arduino CI Arduino-lint JSON check GitHub issues

License: MIT GitHub release PlatformIO Registry

AD5248

Arduino library for I2C digital potentioMeter AD5243 and rheostat AD5248

Description

The AD5243 is a digital potentiometer, the AD5248 is a digital rheostat.

device channels steps ranges KΩ notes :
AD5243 2 256 2.5, 10, 50, 100 potentioMeter
AD5248 2 256 2.5, 10, 50, 100 rheostat

Both IC's have two "channels" and they do not have the output lines some other IC's in these series have e.g. like the AD5242.

The AD5243 has a fixed address (0x2F = 47 decimal) while the AD5248 has two address pins giving 4 possible addresses. See table below.

Addr(dec) Addr(Hex) AD1 AD0 Notes
44 0x2C GND GND
45 0x2D GND +5V
46 0x2E +5V GND
47 0x2F +5V +5V fixed address of AD5243

An important property of the devices is that they defaults to their mid position at startup.

The library defines AD5248_MIDPOINT == 127. To be used to set to defined mid-point.

Compatibles

If you know compatible devices please let me know.

Interface

#include "AD5248.h"

The library has a number of functions which are all quite straightforward. One can get / set the value of (both) the potentiometer(s), and the O1 and O2 output lines.

Constructors

  • AD5243(TwoWire *wire = &Wire) constructor base class, creates an instance with 2 potentiometers.
  • AD5248(uint8_t address, TwoWire *wire = &Wire) create an instance with 2 rheostats.
  • bool begin() initialization of the object. Note the user must call wire.begin() or equivalent before calling begin().
  • bool isConnected() See if the address set in constructor is on the I2C bus.
  • uint8_t getAddress() Returns address set in the constructor, or fixed 0x2F for the AD5243.

Read write

  • uint8_t read(uint8_t channel) read back the set value.
  • uint8_t write(uint8_t channel, uint8_t value) set channel 0/1 to value 0..255.
  • uint8_t zeroAll() sets all potentiometer's to 0 and I/O to LOW.
  • uint8_t reset() sets all potentiometer's to midpoint == 127. (startup default)
  • uint8_t midScaleReset(uint8_t channel) resets one potentiometer to midpoint == 127.
  • uint8_t readBackRegister() read register back, for debugging.

Experimental

  • uint8_t shutDown() check datasheet, not tested yet, use at own risk.

Error codes

define value
AD5248_OK 0
AD5248_ERROR 100

Future

Must

  • improve documentation.
  • buy hardware
  • test

Should

  • sync with AD524X library.

Could

Wont

Support

If you appreciate my libraries, you can support the development and maintenance. Improve the quality of the libraries by providing issues and Pull Requests, or donate through PayPal or GitHub sponsors.

Thank you,