public class MCP4641 extends MicrochipPotentiometerBase implements MicrochipPotentiometer
INITIALVALUE_LOADED_FROM_EEPROM, nonVolatileMode, PIN_NOT_AVAILABLE| Constructor and Description |
|---|
MCP4641(I2CBus i2cBus,
boolean pinA0,
boolean pinA1,
boolean pinA2,
MicrochipPotentiometerChannel channel,
MicrochipPotentiometerNonVolatileMode nonVolatileMode)
Builds an instance which is ready to use.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getMaxValue() |
MicrochipPotentiometerChannel[] |
getSupportedChannelsByDevice() |
boolean |
isCapableOfNonVolatileWiper() |
boolean |
isRheostat() |
static void |
main(String[] args)
A MCP4641 is expected to be connected to I2C-bus 1 of Raspberry Pi.
|
static int |
maxValue() |
void |
setNonVolatileMode(MicrochipPotentiometerNonVolatileMode nonVolatileMode)
The visibility of this method is protected because not all
devices support non-volatile wipers.
|
buildI2CAddress, decrease, decrease, equals, getChannel, getCurrentValue, getDeviceStatus, getNonVolatileMode, getNonVolatileValue, getTerminalConfiguration, increase, increase, initialize, isChannelSupportedByDevice, setCurrentValue, setTerminalConfiguration, setWiperLock, setWriteProtection, toString, updateCacheFromDeviceclearProperties, getName, getProperties, getProperty, getProperty, getTag, hasProperty, removeProperty, setName, setProperty, setTagclone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetChannel, getDeviceStatus, getNonVolatileMode, getTerminalConfiguration, isChannelSupportedByDevice, setTerminalConfiguration, setWiperLock, setWriteProtection, updateCacheFromDevicedecrease, decrease, getCurrentValue, increase, increase, setCurrentValueclearProperties, getName, getProperties, getProperty, getProperty, getTag, hasProperty, removeProperty, setName, setProperty, setTagpublic MCP4641(I2CBus i2cBus, boolean pinA0, boolean pinA1, boolean pinA2, MicrochipPotentiometerChannel channel, MicrochipPotentiometerNonVolatileMode nonVolatileMode) throws IOException
i2cBus - The Pi4J-I2CBus to which the device is connected topinA0 - Whether the device's address pin A0 is high (true) or low (false)pinA1 - Whether the device's address pin A1 (if available) is high (true) or low (false)pinA2 - Whether the device's address pin A2 (if available) is high (true) or low (false)channel - Which of the potentiometers provided by the device to controlnonVolatileMode - The way non-volatile reads or writes are doneIOException - Thrown if communication fails or device returned a malformed resultpublic boolean isCapableOfNonVolatileWiper()
isCapableOfNonVolatileWiper in interface MicrochipPotentiometerisCapableOfNonVolatileWiper in class MicrochipPotentiometerBasepublic void setNonVolatileMode(MicrochipPotentiometerNonVolatileMode nonVolatileMode)
MicrochipPotentiometerBasesetNonVolatileMode in class MicrochipPotentiometerBasenonVolatileMode - The way non-volatile reads or writes are donepublic int getMaxValue()
getMaxValue in interface Potentiometerpublic static int maxValue()
public boolean isRheostat()
isRheostat in interface Potentiometerpublic MicrochipPotentiometerChannel[] getSupportedChannelsByDevice()
getSupportedChannelsByDevice in interface MicrochipPotentiometergetSupportedChannelsByDevice in class MicrochipPotentiometerBasepublic static void main(String[] args) throws I2CFactory.UnsupportedBusNumberException, IOException
Both channels of the are initialized at mid-value (the same value as hardware-preset). A is brought to max-value and B to min-value in about 3 seconds. After that A and B are going up and down (26 steps per second for 5 seconds). Afterwards A and B are set at random (2 times per second for 5 seconds).
At the end A and B are set to random-values for both the volatile and the non-volatile wipers. So after putting the IC off power and on power those random values should reloaded to the volatile wipers by the IC.
args - no parameters expectedIOException - If anything goes wrongI2CFactory.UnsupportedBusNumberExceptionCopyright © 2012–2019 Pi4J. All rights reserved.