By dave | May 22, 2023

PGA2310 Volume Control device

Provides a simple analog device that can be used to control a PGA2310 volume device. Left channel is 0 and right channel is 1. The device should be connected on the SPI bus as usual. This should work with Arduino now, and mbed in a patch release coming soon. To use first include the header:

#include <extras/Pga2310VolumeControl.h>

Then initialise globally:

SPIWithSettings spiSettings(&SPI, CS_PIN);
Pga2310VolumeControl pga2310(spiSettings);

And to use it as a floating point value

pga2310.setCurrentFloat(volFlt); // where the value is between 0F and 1F 
float f = pga2310.getCurrentFloat(); // where the value is between 0F and 1F 

or as an integer

pga2310.setCurrentValue(intVal);  // where the value is between 0 and 255
unsigned int val = pga2310.getCurrentValue();  // where the value is between 0 and 255

This covers everything for this device.

Other pages within this category

comments powered by Disqus

This site uses cookies to analyse traffic, and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.

Send a message

Please use the forum for help with UI & libraries.

This message will be securely transmitted to our servers.