Class ADC


  • public class ADC
    extends java.lang.Object
    This class represents the MCP3008 Analog-To-Digital Converter chip connected of the Raspberry Pi.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static short ADC_CHANNEL_COUNT
      The maximum number of channels available on the ADC chip.
    • Constructor Summary

      Constructors 
      Constructor Description
      ADC()
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int read​(int channel)
      Reads the value of the specified ADC channel.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ADC_CHANNEL_COUNT

        public static short ADC_CHANNEL_COUNT
        The maximum number of channels available on the ADC chip.
    • Constructor Detail

      • ADC

        public ADC()
            throws java.io.IOException
        Constructor.
        Throws:
        java.io.IOException - If the SPI interface cannot be opened.
    • Method Detail

      • read

        public int read​(int channel)
                 throws java.io.IOException
        Reads the value of the specified ADC channel.
        Parameters:
        channel - The AdC channel to read.
        Returns:
        The value of the specified ADC channel.
        Throws:
        java.io.IOException - If the SPI interface cannot be opened.