diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..6d764cfa
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,56 @@
+# Python specific .gitignore
+# GitHub recommended entries from https://github.com/github/gitignore
+
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+bin/
+build/
+develop-eggs/
+dist/
+eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.cache
+nosetests.xml
+coverage.xml
+
+# Translations
+*.mo
+
+# Mr Developer
+.mr.developer.cfg
+.project
+.pydevproject
+
+# Rope
+.ropeproject
+
+# Django stuff:
+*.log
+*.pot
+
+# Sphinx documentation
+docs/_build/
diff --git a/Adafruit_ADS1x15/Adafruit_ADS1x15.py b/Adafruit_ADS1x15/Adafruit_ADS1x15.py
deleted file mode 100644
index 96a99feb..00000000
--- a/Adafruit_ADS1x15/Adafruit_ADS1x15.py
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/usr/bin/python
-
-import time
-import smbus
-from Adafruit_I2C import Adafruit_I2C
-
-# ===========================================================================
-# ADS1x15 Class
-# ===========================================================================
-
-class ADS1x15:
- i2c = None
-
- # IC Identifiers
- __IC_ADS1015 = 0x00
- __IC_ADS1115 = 0x01
-
- # Pointer Register
- __ADS1015_REG_POINTER_MASK = 0x03
- __ADS1015_REG_POINTER_CONVERT = 0x00
- __ADS1015_REG_POINTER_CONFIG = 0x01
- __ADS1015_REG_POINTER_LOWTHRESH = 0x02
- __ADS1015_REG_POINTER_HITHRESH = 0x03
-
- # Config Register
- __ADS1015_REG_CONFIG_OS_MASK = 0x8000
- __ADS1015_REG_CONFIG_OS_SINGLE = 0x8000 # Write: Set to start a single-conversion
- __ADS1015_REG_CONFIG_OS_BUSY = 0x0000 # Read: Bit = 0 when conversion is in progress
- __ADS1015_REG_CONFIG_OS_NOTBUSY = 0x8000 # Read: Bit = 1 when device is not performing a conversion
-
- __ADS1015_REG_CONFIG_MUX_MASK = 0x7000
- __ADS1015_REG_CONFIG_MUX_DIFF_0_1 = 0x0000 # Differential P = AIN0, N = AIN1 (default)
- __ADS1015_REG_CONFIG_MUX_DIFF_0_3 = 0x1000 # Differential P = AIN0, N = AIN3
- __ADS1015_REG_CONFIG_MUX_DIFF_1_3 = 0x2000 # Differential P = AIN1, N = AIN3
- __ADS1015_REG_CONFIG_MUX_DIFF_2_3 = 0x3000 # Differential P = AIN2, N = AIN3
- __ADS1015_REG_CONFIG_MUX_SINGLE_0 = 0x4000 # Single-ended AIN0
- __ADS1015_REG_CONFIG_MUX_SINGLE_1 = 0x5000 # Single-ended AIN1
- __ADS1015_REG_CONFIG_MUX_SINGLE_2 = 0x6000 # Single-ended AIN2
- __ADS1015_REG_CONFIG_MUX_SINGLE_3 = 0x7000 # Single-ended AIN3
-
- __ADS1015_REG_CONFIG_PGA_MASK = 0x0E00
- __ADS1015_REG_CONFIG_PGA_6_144V = 0x0000 # +/-6.144V range
- __ADS1015_REG_CONFIG_PGA_4_096V = 0x0200 # +/-4.096V range
- __ADS1015_REG_CONFIG_PGA_2_048V = 0x0400 # +/-2.048V range (default)
- __ADS1015_REG_CONFIG_PGA_1_024V = 0x0600 # +/-1.024V range
- __ADS1015_REG_CONFIG_PGA_0_512V = 0x0800 # +/-0.512V range
- __ADS1015_REG_CONFIG_PGA_0_256V = 0x0A00 # +/-0.256V range
-
- __ADS1015_REG_CONFIG_MODE_MASK = 0x0100
- __ADS1015_REG_CONFIG_MODE_CONTIN = 0x0000 # Continuous conversion mode
- __ADS1015_REG_CONFIG_MODE_SINGLE = 0x0100 # Power-down single-shot mode (default)
-
- __ADS1015_REG_CONFIG_DR_MASK = 0x00E0
- __ADS1015_REG_CONFIG_DR_128SPS = 0x0000 # 128 samples per second
- __ADS1015_REG_CONFIG_DR_250SPS = 0x0020 # 250 samples per second
- __ADS1015_REG_CONFIG_DR_490SPS = 0x0040 # 490 samples per second
- __ADS1015_REG_CONFIG_DR_920SPS = 0x0050 # 920 samples per second
- __ADS1015_REG_CONFIG_DR_1600SPS = 0x0080 # 1600 samples per second (default)
- __ADS1015_REG_CONFIG_DR_2400SPS = 0x00A0 # 2400 samples per second
- __ADS1015_REG_CONFIG_DR_3300SPS = 0x00C0 # 3300 samples per second
-
- __ADS1115_REG_CONFIG_DR_8SPS = 0x0000 # 8 samples per second
- __ADS1115_REG_CONFIG_DR_16SPS = 0x0020 # 16 samples per second
- __ADS1115_REG_CONFIG_DR_32SPS = 0x0040 # 32 samples per second
- __ADS1115_REG_CONFIG_DR_64SPS = 0x0060 # 64 samples per second
- __ADS1115_REG_CONFIG_DR_128SPS = 0x0080 # 128 samples per second
- __ADS1115_REG_CONFIG_DR_250SPS = 0x00A0 # 250 samples per second (default)
- __ADS1115_REG_CONFIG_DR_475SPS = 0x00C0 # 475 samples per second
- __ADS1115_REG_CONFIG_DR_860SPS = 0x00E0 # 860 samples per second
-
- __ADS1015_REG_CONFIG_CMODE_MASK = 0x0010
- __ADS1015_REG_CONFIG_CMODE_TRAD = 0x0000 # Traditional comparator with hysteresis (default)
- __ADS1015_REG_CONFIG_CMODE_WINDOW = 0x0010 # Window comparator
-
- __ADS1015_REG_CONFIG_CPOL_MASK = 0x0008
- __ADS1015_REG_CONFIG_CPOL_ACTVLOW = 0x0000 # ALERT/RDY pin is low when active (default)
- __ADS1015_REG_CONFIG_CPOL_ACTVHI = 0x0008 # ALERT/RDY pin is high when active
-
- __ADS1015_REG_CONFIG_CLAT_MASK = 0x0004 # Determines if ALERT/RDY pin latches once asserted
- __ADS1015_REG_CONFIG_CLAT_NONLAT = 0x0000 # Non-latching comparator (default)
- __ADS1015_REG_CONFIG_CLAT_LATCH = 0x0004 # Latching comparator
-
- __ADS1015_REG_CONFIG_CQUE_MASK = 0x0003
- __ADS1015_REG_CONFIG_CQUE_1CONV = 0x0000 # Assert ALERT/RDY after one conversions
- __ADS1015_REG_CONFIG_CQUE_2CONV = 0x0001 # Assert ALERT/RDY after two conversions
- __ADS1015_REG_CONFIG_CQUE_4CONV = 0x0002 # Assert ALERT/RDY after four conversions
- __ADS1015_REG_CONFIG_CQUE_NONE = 0x0003 # Disable the comparator and put ALERT/RDY in high state (default)
-
- # Constructor
- def __init__(self, address=0x48, ic=__IC_ADS1015, debug=False):
- # Depending on if you have an old or a new Raspberry Pi, you
- # may need to change the I2C bus. Older Pis use SMBus 0,
- # whereas new Pis use SMBus 1. If you see an error like:
- # 'Error accessing 0x48: Check your I2C address '
- # change the SMBus number in the initializer below!
- self.i2c = Adafruit_I2C(address)
- self.address = address
- self.debug = debug
-
- # Make sure the IC specified is valid
- if ((ic < self.__IC_ADS1015) | (ic > self.__IC_ADS1115)):
- if (self.debug):
- print "ADS1x15: Invalid IC. Using the ADS1015 by default"
- self.ic = __IC_ADS1015
- else:
- self.ic = ic
-
- def readADCSingleEnded(self, channel=0):
- "Gets a single-ended ADC reading from the specified channel (1 bit = 3mV)"
- # Default to channel 0 with invalid channel, or return -1?
- if (channel > 3):
- if (self.debug):
- print "ADS1x15: Invalid channel specified: %d" % channel
- return -1
-
- # Set default values
- if (self.ic == self.__IC_ADS1015):
- config = self.__ADS1015_REG_CONFIG_CQUE_NONE | \
- self.__ADS1015_REG_CONFIG_CLAT_NONLAT | \
- self.__ADS1015_REG_CONFIG_CPOL_ACTVLOW | \
- self.__ADS1015_REG_CONFIG_CMODE_TRAD | \
- self.__ADS1015_REG_CONFIG_DR_1600SPS | \
- self.__ADS1015_REG_CONFIG_MODE_SINGLE
- else:
- config = self.__ADS1015_REG_CONFIG_CQUE_NONE | \
- self.__ADS1015_REG_CONFIG_CLAT_NONLAT | \
- self.__ADS1015_REG_CONFIG_CPOL_ACTVLOW | \
- self.__ADS1015_REG_CONFIG_CMODE_TRAD | \
- self.__ADS1115_REG_CONFIG_DR_250SPS | \
- self.__ADS1015_REG_CONFIG_MODE_SINGLE
-
- # Set PGA/voltage range to max value (+/- 6.144V)
- config |= self.__ADS1015_REG_CONFIG_PGA_6_144V
-
- if channel == 3:
- config |= self.__ADS1015_REG_CONFIG_MUX_SINGLE_3
- elif channel == 2:
- config |= self.__ADS1015_REG_CONFIG_MUX_SINGLE_2
- elif channel == 1:
- config |= self.__ADS1015_REG_CONFIG_MUX_SINGLE_1
- else:
- config |= self.__ADS1015_REG_CONFIG_MUX_SINGLE_0
-
- # Set 'start single-conversion' bit
- config |= self.__ADS1015_REG_CONFIG_OS_SINGLE
-
- # Write config register to the ADC
- bytes = [(config >> 8) & 0xFF, config & 0xFF]
- self.i2c.writeList(self.__ADS1015_REG_POINTER_CONFIG, bytes)
-
- # Wait for the ADC conversion to complete
- if (self.ic == self.__IC_ADS1015):
- time.sleep(0.001)
- else:
- time.sleep(0.008)
-
- # Read the conversion results
- result = self.i2c.readList(self.__ADS1015_REG_POINTER_CONVERT, 2)
- if (self.ic == self.__IC_ADS1015):
- # Shift right 4 bits for the 12-bit ADS1015
- return ( ((result[0] << 8) | (result[1] & 0xFF)) >> 4 )
- else:
- # Return 16-bit value for the ADS1115
- # (Take signed values into account as well)
- val = (result[0] << 8) | (result[1])
- if val > 0x7FFF:
- return val - 0xFFFF
- else:
- return (result[0] << 8) | (result[1])
-
- def readADCDifferential01(self):
- "Gets a differential ADC reading from channels 0 and 1"
-
- def readADCDifferential23(self):
- "Gets a differential ADC reading from channels 2 and 3"
-
- def startSingleEndedComparator(self, channel, threshold):
- "Starts the comparator in single-ended mode on the specified channel"
-
- def getLastConversionResults(self):
- "Returns the last ADC conversion result"
diff --git a/Adafruit_ADS1x15/Adafruit_I2C.py b/Adafruit_ADS1x15/Adafruit_I2C.py
deleted file mode 120000
index 77f06164..00000000
--- a/Adafruit_ADS1x15/Adafruit_I2C.py
+++ /dev/null
@@ -1 +0,0 @@
-../Adafruit_I2C/Adafruit_I2C.py
\ No newline at end of file
diff --git a/Adafruit_ADS1x15/ads1015_example.py b/Adafruit_ADS1x15/ads1015_example.py
deleted file mode 100644
index 2a4d6285..00000000
--- a/Adafruit_ADS1x15/ads1015_example.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/python
-
-from Adafruit_ADS1x15 import ADS1x15
-
-# ============================================================================
-# Example Code
-# ============================================================================
-ADS1015 = 0x00 # 12-bit ADC
-ADS1115 = 0x01 # 16-bit ADC
-
-# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-# ToDo: Change the value below depending on which chip you're using!
-# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-ADS_Current = ADS1115
-
-# Initialise the ADC using the default mode (use default I2C address)
-adc = ADS1x15(ic=ADS_Current)
-
-# Read channel 0 in single-ended mode
-result = adc.readADCSingleEnded(0)
-if ADS_Current == ADS1015:
- # For ADS1015 at max range (+/-6.144V) 1 bit = 3mV (12-bit values)
- print "Channel 0 = %.3f V" % (result * 0.003)
-else:
- # For ADS1115 at max range (+/-6.144V) 1-bit = 0.1875mV (16-bit values)
- print "Channel 0 = %.3f V" % (result * 0.0001875)
-
-# Read channel 1 in single-ended mode
-result = adc.readADCSingleEnded(1)
-if ADS_Current == ADS1015:
- # For ADS1015 at max range (+/-6.144V) 1 bit = 3mV (12-bit values)
- print "Channel 1 = %.3f V" % (result * 0.003)
-else:
- # For ADS1115 at max range (+/-6.144V) 1-bit = 0.1875mV (16-bit values)
- print "Channel 1 = %.3f V" % (result * 0.0001875)
diff --git a/Adafruit_BMP085/Adafruit_BMP085.py b/Adafruit_BMP085/Adafruit_BMP085.py
deleted file mode 100755
index 191be94d..00000000
--- a/Adafruit_BMP085/Adafruit_BMP085.py
+++ /dev/null
@@ -1,241 +0,0 @@
-#!/usr/bin/python
-
-import time
-from Adafruit_I2C import Adafruit_I2C
-
-# ===========================================================================
-# BMP085 Class
-# ===========================================================================
-
-class BMP085 :
- i2c = None
-
- # Operating Modes
- __BMP085_ULTRALOWPOWER = 0
- __BMP085_STANDARD = 1
- __BMP085_HIGHRES = 2
- __BMP085_ULTRAHIGHRES = 3
-
- # BMP085 Registers
- __BMP085_CAL_AC1 = 0xAA # R Calibration data (16 bits)
- __BMP085_CAL_AC2 = 0xAC # R Calibration data (16 bits)
- __BMP085_CAL_AC3 = 0xAE # R Calibration data (16 bits)
- __BMP085_CAL_AC4 = 0xB0 # R Calibration data (16 bits)
- __BMP085_CAL_AC5 = 0xB2 # R Calibration data (16 bits)
- __BMP085_CAL_AC6 = 0xB4 # R Calibration data (16 bits)
- __BMP085_CAL_B1 = 0xB6 # R Calibration data (16 bits)
- __BMP085_CAL_B2 = 0xB8 # R Calibration data (16 bits)
- __BMP085_CAL_MB = 0xBA # R Calibration data (16 bits)
- __BMP085_CAL_MC = 0xBC # R Calibration data (16 bits)
- __BMP085_CAL_MD = 0xBE # R Calibration data (16 bits)
- __BMP085_CONTROL = 0xF4
- __BMP085_TEMPDATA = 0xF6
- __BMP085_PRESSUREDATA = 0xF6
- __BMP085_READTEMPCMD = 0x2E
- __BMP085_READPRESSURECMD = 0x34
-
- # Private Fields
- _cal_AC1 = 0
- _cal_AC2 = 0
- _cal_AC3 = 0
- _cal_AC4 = 0
- _cal_AC5 = 0
- _cal_AC6 = 0
- _cal_B1 = 0
- _cal_B2 = 0
- _cal_MB = 0
- _cal_MC = 0
- _cal_MD = 0
-
- # Constructor
- def __init__(self, address=0x77, mode=1, debug=False):
- self.i2c = Adafruit_I2C(address)
-
- self.address = address
- self.debug = debug
- # Make sure the specified mode is in the appropriate range
- if ((mode < 0) | (mode > 3)):
- if (self.debug):
- print "Invalid Mode: Using STANDARD by default"
- self.mode = self.__BMP085_STANDARD
- else:
- self.mode = mode
- # Read the calibration data
- self.readCalibrationData()
-
- def readCalibrationData(self):
- "Reads the calibration data from the IC"
- self._cal_AC1 = self.i2c.readS16(self.__BMP085_CAL_AC1) # INT16
- self._cal_AC2 = self.i2c.readS16(self.__BMP085_CAL_AC2) # INT16
- self._cal_AC3 = self.i2c.readS16(self.__BMP085_CAL_AC3) # INT16
- self._cal_AC4 = self.i2c.readU16(self.__BMP085_CAL_AC4) # UINT16
- self._cal_AC5 = self.i2c.readU16(self.__BMP085_CAL_AC5) # UINT16
- self._cal_AC6 = self.i2c.readU16(self.__BMP085_CAL_AC6) # UINT16
- self._cal_B1 = self.i2c.readS16(self.__BMP085_CAL_B1) # INT16
- self._cal_B2 = self.i2c.readS16(self.__BMP085_CAL_B2) # INT16
- self._cal_MB = self.i2c.readS16(self.__BMP085_CAL_MB) # INT16
- self._cal_MC = self.i2c.readS16(self.__BMP085_CAL_MC) # INT16
- self._cal_MD = self.i2c.readS16(self.__BMP085_CAL_MD) # INT16
- if (self.debug):
- self.showCalibrationData()
-
- def showCalibrationData(self):
- "Displays the calibration values for debugging purposes"
- print "DBG: AC1 = %6d" % (self._cal_AC1)
- print "DBG: AC2 = %6d" % (self._cal_AC2)
- print "DBG: AC3 = %6d" % (self._cal_AC3)
- print "DBG: AC4 = %6d" % (self._cal_AC4)
- print "DBG: AC5 = %6d" % (self._cal_AC5)
- print "DBG: AC6 = %6d" % (self._cal_AC6)
- print "DBG: B1 = %6d" % (self._cal_B1)
- print "DBG: B2 = %6d" % (self._cal_B2)
- print "DBG: MB = %6d" % (self._cal_MB)
- print "DBG: MC = %6d" % (self._cal_MC)
- print "DBG: MD = %6d" % (self._cal_MD)
-
- def readRawTemp(self):
- "Reads the raw (uncompensated) temperature from the sensor"
- self.i2c.write8(self.__BMP085_CONTROL, self.__BMP085_READTEMPCMD)
- time.sleep(0.005) # Wait 5ms
- raw = self.i2c.readU16(self.__BMP085_TEMPDATA)
- if (self.debug):
- print "DBG: Raw Temp: 0x%04X (%d)" % (raw & 0xFFFF, raw)
- return raw
-
- def readRawPressure(self):
- "Reads the raw (uncompensated) pressure level from the sensor"
- self.i2c.write8(self.__BMP085_CONTROL, self.__BMP085_READPRESSURECMD + (self.mode << 6))
- if (self.mode == self.__BMP085_ULTRALOWPOWER):
- time.sleep(0.005)
- elif (self.mode == self.__BMP085_HIGHRES):
- time.sleep(0.014)
- elif (self.mode == self.__BMP085_ULTRAHIGHRES):
- time.sleep(0.026)
- else:
- time.sleep(0.008)
- msb = self.i2c.readU8(self.__BMP085_PRESSUREDATA)
- lsb = self.i2c.readU8(self.__BMP085_PRESSUREDATA+1)
- xlsb = self.i2c.readU8(self.__BMP085_PRESSUREDATA+2)
- raw = ((msb << 16) + (lsb << 8) + xlsb) >> (8 - self.mode)
- if (self.debug):
- print "DBG: Raw Pressure: 0x%04X (%d)" % (raw & 0xFFFF, raw)
- return raw
-
- def readTemperature(self):
- "Gets the compensated temperature in degrees celcius"
- UT = 0
- X1 = 0
- X2 = 0
- B5 = 0
- temp = 0.0
-
- # Read raw temp before aligning it with the calibration values
- UT = self.readRawTemp()
- X1 = ((UT - self._cal_AC6) * self._cal_AC5) >> 15
- X2 = (self._cal_MC << 11) / (X1 + self._cal_MD)
- B5 = X1 + X2
- temp = ((B5 + 8) >> 4) / 10.0
- if (self.debug):
- print "DBG: Calibrated temperature = %f C" % temp
- return temp
-
- def readPressure(self):
- "Gets the compensated pressure in pascal"
- UT = 0
- UP = 0
- B3 = 0
- B5 = 0
- B6 = 0
- X1 = 0
- X2 = 0
- X3 = 0
- p = 0
- B4 = 0
- B7 = 0
-
- UT = self.readRawTemp()
- UP = self.readRawPressure()
-
- # You can use the datasheet values to test the conversion results
- # dsValues = True
- dsValues = False
-
- if (dsValues):
- UT = 27898
- UP = 23843
- self._cal_AC6 = 23153
- self._cal_AC5 = 32757
- self._cal_MC = -8711
- self._cal_MD = 2868
- self._cal_B1 = 6190
- self._cal_B2 = 4
- self._cal_AC3 = -14383
- self._cal_AC2 = -72
- self._cal_AC1 = 408
- self._cal_AC4 = 32741
- self.mode = self.__BMP085_ULTRALOWPOWER
- if (self.debug):
- self.showCalibrationData()
-
- # True Temperature Calculations
- X1 = ((UT - self._cal_AC6) * self._cal_AC5) >> 15
- X2 = (self._cal_MC << 11) / (X1 + self._cal_MD)
- B5 = X1 + X2
- if (self.debug):
- print "DBG: X1 = %d" % (X1)
- print "DBG: X2 = %d" % (X2)
- print "DBG: B5 = %d" % (B5)
- print "DBG: True Temperature = %.2f C" % (((B5 + 8) >> 4) / 10.0)
-
- # Pressure Calculations
- B6 = B5 - 4000
- X1 = (self._cal_B2 * (B6 * B6) >> 12) >> 11
- X2 = (self._cal_AC2 * B6) >> 11
- X3 = X1 + X2
- B3 = (((self._cal_AC1 * 4 + X3) << self.mode) + 2) / 4
- if (self.debug):
- print "DBG: B6 = %d" % (B6)
- print "DBG: X1 = %d" % (X1)
- print "DBG: X2 = %d" % (X2)
- print "DBG: B3 = %d" % (B3)
-
- X1 = (self._cal_AC3 * B6) >> 13
- X2 = (self._cal_B1 * ((B6 * B6) >> 12)) >> 16
- X3 = ((X1 + X2) + 2) >> 2
- B4 = (self._cal_AC4 * (X3 + 32768)) >> 15
- B7 = (UP - B3) * (50000 >> self.mode)
- if (self.debug):
- print "DBG: X1 = %d" % (X1)
- print "DBG: X2 = %d" % (X2)
- print "DBG: B4 = %d" % (B4)
- print "DBG: B7 = %d" % (B7)
-
- if (B7 < 0x80000000):
- p = (B7 * 2) / B4
- else:
- p = (B7 / B4) * 2
-
- X1 = (p >> 8) * (p >> 8)
- X1 = (X1 * 3038) >> 16
- X2 = (-7375 * p) >> 16
- if (self.debug):
- print "DBG: p = %d" % (p)
- print "DBG: X1 = %d" % (X1)
- print "DBG: X2 = %d" % (X2)
-
- p = p + ((X1 + X2 + 3791) >> 4)
- if (self.debug):
- print "DBG: Pressure = %d Pa" % (p)
-
- return p
-
- def readAltitude(self, seaLevelPressure=101325):
- "Calculates the altitude in meters"
- altitude = 0.0
- pressure = float(self.readPressure())
- altitude = 44330.0 * (1.0 - pow(pressure / seaLevelPressure, 0.1903))
- if (self.debug):
- print "DBG: Altitude = %d" % (altitude)
- return altitude
-
- return 0
diff --git a/Adafruit_BMP085/Adafruit_BMP085_example.py b/Adafruit_BMP085/Adafruit_BMP085_example.py
deleted file mode 100755
index 5e0d0bef..00000000
--- a/Adafruit_BMP085/Adafruit_BMP085_example.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/python
-
-from Adafruit_BMP085 import BMP085
-
-# ===========================================================================
-# Example Code
-# ===========================================================================
-
-# Initialise the BMP085 and use STANDARD mode (default value)
-# bmp = BMP085(0x77, debug=True)
-bmp = BMP085(0x77)
-
-# To specify a different operating mode, uncomment one of the following:
-# bmp = BMP085(0x77, 0) # ULTRALOWPOWER Mode
-# bmp = BMP085(0x77, 1) # STANDARD Mode
-# bmp = BMP085(0x77, 2) # HIRES Mode
-# bmp = BMP085(0x77, 3) # ULTRAHIRES Mode
-
-temp = bmp.readTemperature()
-pressure = bmp.readPressure()
-altitude = bmp.readAltitude()
-
-print "Temperature: %.2f C" % temp
-print "Pressure: %.2f hPa" % (pressure / 100.0)
-print "Altitude: %.2f" % altitude
diff --git a/Adafruit_BMP085/Adafruit_BMP085_googledocs_ex.py b/Adafruit_BMP085/Adafruit_BMP085_googledocs_ex.py
deleted file mode 100755
index 4d62cd0b..00000000
--- a/Adafruit_BMP085/Adafruit_BMP085_googledocs_ex.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import time
-import datetime
-import gspread
-from Adafruit_BMP085 import BMP085
-
-# ===========================================================================
-# Google Account Details
-# ===========================================================================
-
-# Account details for google docs
-email = 'you@somewhere.com'
-password = '$hhh!'
-spreadsheet = 'SpreadsheetName'
-
-# ===========================================================================
-# Example Code
-# ===========================================================================
-
-# Initialise the BMP085 and use STANDARD mode (default value)
-# bmp = BMP085(0x77, debug=True)
-bmp = BMP085(0x77)
-
-# To specify a different operating mode, uncomment one of the following:
-# bmp = BMP085(0x77, 0) # ULTRALOWPOWER Mode
-# bmp = BMP085(0x77, 1) # STANDARD Mode
-# bmp = BMP085(0x77, 2) # HIRES Mode
-# bmp = BMP085(0x77, 3) # ULTRAHIRES Mode
-
-# Login with your Google account
-try:
- gc = gspread.login(email, password)
-except:
- print "Unable to log in. Check your email address/password"
- sys.exit()
-
-# Open a worksheet from your spreadsheet using the filename
-try:
- worksheet = gc.open(spreadsheet).sheet1
- # Alternatively, open a spreadsheet using the spreadsheet's key
- # worksheet = gc.open_by_key('0BmgG6nO_6dprdS1MN3d3MkdPa142WFRrdnRRUWl1UFE')
-except:
- print "Unable to open the spreadsheet. Check your filename: %s" % spreadsheet
- sys.exit()
-
-# Continuously append data
-while(True):
- temp = bmp.readTemperature()
- pressure = bmp.readPressure()
- altitude = bmp.readAltitude()
-
- print "Temperature: %.2f C" % temp
- print "Pressure: %.2f hPa" % (pressure / 100.0)
- print "Altitude: %.2f" % altitude
-
- # Append the data in the spreadsheet, including a timestamp
- try:
- values = [datetime.datetime.now(), temp, pressure, altitude]
- worksheet.append_row(values)
- except:
- print "Unable to append data. Check your connection?"
- sys.exit()
-
- # Wait 5 seconds before continuing
- print "Wrote a row to %s" % spreadsheet
- time.sleep(5)
-
diff --git a/Adafruit_BMP085/Adafruit_I2C.py b/Adafruit_BMP085/Adafruit_I2C.py
deleted file mode 100755
index dd2dfa76..00000000
--- a/Adafruit_BMP085/Adafruit_I2C.py
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/python
-
-import smbus
-
-# ===========================================================================
-# Adafruit_I2C Base Class
-# ===========================================================================
-
-class Adafruit_I2C :
-
- def __init__(self, address, bus=smbus.SMBus(0), debug=False):
- self.address = address
- self.bus = bus
- self.debug = debug
-
- def reverseByteOrder(self, data):
- "Reverses the byte order of an int (16-bit) or long (32-bit) value"
- # Courtesy Vishal Sapre
- dstr = hex(data)[2:].replace('L','')
- byteCount = len(dstr[::2])
- val = 0
- for i, n in enumerate(range(byteCount)):
- d = data & 0xFF
- val |= (d << (8 * (byteCount - i - 1)))
- data >>= 8
- return val
-
- def write8(self, reg, value):
- "Writes an 8-bit value to the specified register/address"
- try:
- self.bus.write_byte_data(self.address, reg, value)
- if (self.debug):
- print("I2C: Wrote 0x%02X to register 0x%02X" % (value, reg))
- except IOError, err:
- print "Error accessing 0x%02X: Check your I2C address" % self.address
- return -1
-
- def writeList(self, reg, list):
- "Writes an array of bytes using I2C format"
- try:
- self.bus.write_i2c_block_data(self.address, reg, list)
- except IOError, err:
- print "Error accessing 0x%02X: Check your I2C address" % self.address
- return -1
-
- def readU8(self, reg):
- "Read an unsigned byte from the I2C device"
- try:
- result = self.bus.read_byte_data(self.address, reg)
- if (self.debug):
- print "I2C: Device 0x%02X returned 0x%02X from reg 0x%02X" % (self.address, result & 0xFF, reg)
- return result
- except IOError, err:
- print "Error accessing 0x%02X: Check your I2C address" % self.address
- return -1
-
- def readS8(self, reg):
- "Reads a signed byte from the I2C device"
- try:
- result = self.bus.read_byte_data(self.address, reg)
- if (self.debug):
- print "I2C: Device 0x%02X returned 0x%02X from reg 0x%02X" % (self.address, result & 0xFF, reg)
- if (result > 127):
- return result - 256
- else:
- return result
- except IOError, err:
- print "Error accessing 0x%02X: Check your I2C address" % self.address
- return -1
-
- def readU16(self, reg):
- "Reads an unsigned 16-bit value from the I2C device"
- try:
- hibyte = self.bus.read_byte_data(self.address, reg)
- result = (hibyte << 8) + self.bus.read_byte_data(self.address, reg+1)
- if (self.debug):
- print "I2C: Device 0x%02X returned 0x%04X from reg 0x%02X" % (self.address, result & 0xFFFF, reg)
- return result
- except IOError, err:
- print "Error accessing 0x%02X: Check your I2C address" % self.address
- return -1
-
- def readS16(self, reg):
- "Reads a signed 16-bit value from the I2C device"
- try:
- hibyte = self.bus.read_byte_data(self.address, reg)
- if (hibyte > 127):
- hibyte -= 256
- result = (hibyte << 8) + self.bus.read_byte_data(self.address, reg+1)
- if (self.debug):
- print "I2C: Device 0x%02X returned 0x%04X from reg 0x%02X" % (self.address, result & 0xFFFF, reg)
- return result
- except IOError, err:
- print "Error accessing 0x%02X: Check your I2C address" % self.address
- return -1
diff --git a/Adafruit_CharLCD/Adafruit_CharLCD.py b/Adafruit_CharLCD/Adafruit_CharLCD.py
deleted file mode 100755
index 22060c94..00000000
--- a/Adafruit_CharLCD/Adafruit_CharLCD.py
+++ /dev/null
@@ -1,261 +0,0 @@
-#!/usr/bin/python
-
-#
-# based on code from lrvick and LiquidCrystal
-# lrvic - https://github.com/lrvick/raspi-hd44780/blob/master/hd44780.py
-# LiquidCrystal - https://github.com/arduino/Arduino/blob/master/libraries/LiquidCrystal/LiquidCrystal.cpp
-#
-
-from time import sleep
-
-class Adafruit_CharLCD:
-
- # commands
- LCD_CLEARDISPLAY = 0x01
- LCD_RETURNHOME = 0x02
- LCD_ENTRYMODESET = 0x04
- LCD_DISPLAYCONTROL = 0x08
- LCD_CURSORSHIFT = 0x10
- LCD_FUNCTIONSET = 0x20
- LCD_SETCGRAMADDR = 0x40
- LCD_SETDDRAMADDR = 0x80
-
- # flags for display entry mode
- LCD_ENTRYRIGHT = 0x00
- LCD_ENTRYLEFT = 0x02
- LCD_ENTRYSHIFTINCREMENT = 0x01
- LCD_ENTRYSHIFTDECREMENT = 0x00
-
- # flags for display on/off control
- LCD_DISPLAYON = 0x04
- LCD_DISPLAYOFF = 0x00
- LCD_CURSORON = 0x02
- LCD_CURSOROFF = 0x00
- LCD_BLINKON = 0x01
- LCD_BLINKOFF = 0x00
-
- # flags for display/cursor shift
- LCD_DISPLAYMOVE = 0x08
- LCD_CURSORMOVE = 0x00
-
- # flags for display/cursor shift
- LCD_DISPLAYMOVE = 0x08
- LCD_CURSORMOVE = 0x00
- LCD_MOVERIGHT = 0x04
- LCD_MOVELEFT = 0x00
-
- # flags for function set
- LCD_8BITMODE = 0x10
- LCD_4BITMODE = 0x00
- LCD_2LINE = 0x08
- LCD_1LINE = 0x00
- LCD_5x10DOTS = 0x04
- LCD_5x8DOTS = 0x00
-
-
-
- def __init__(self, pin_rs=25, pin_e=24, pins_db=[23, 17, 21, 22], GPIO = None):
- # Emulate the old behavior of using RPi.GPIO if we haven't been given
- # an explicit GPIO interface to use
- if not GPIO:
- import RPi.GPIO as GPIO
- self.GPIO = GPIO
- self.pin_rs = pin_rs
- self.pin_e = pin_e
- self.pins_db = pins_db
-
- self.GPIO.setmode(GPIO.BCM)
- self.GPIO.setup(self.pin_e, GPIO.OUT)
- self.GPIO.setup(self.pin_rs, GPIO.OUT)
-
- for pin in self.pins_db:
- self.GPIO.setup(pin, GPIO.OUT)
-
- self.write4bits(0x33) # initialization
- self.write4bits(0x32) # initialization
- self.write4bits(0x28) # 2 line 5x7 matrix
- self.write4bits(0x0C) # turn cursor off 0x0E to enable cursor
- self.write4bits(0x06) # shift cursor right
-
- self.displaycontrol = self.LCD_DISPLAYON | self.LCD_CURSOROFF | self.LCD_BLINKOFF
-
- self.displayfunction = self.LCD_4BITMODE | self.LCD_1LINE | self.LCD_5x8DOTS
- self.displayfunction |= self.LCD_2LINE
-
- """ Initialize to default text direction (for romance languages) """
- self.displaymode = self.LCD_ENTRYLEFT | self.LCD_ENTRYSHIFTDECREMENT
- self.write4bits(self.LCD_ENTRYMODESET | self.displaymode) # set the entry mode
-
- self.clear()
-
-
- def begin(self, cols, lines):
-
- if (lines > 1):
- self.numlines = lines
- self.displayfunction |= self.LCD_2LINE
- self.currline = 0
-
-
- def home(self):
-
- self.write4bits(self.LCD_RETURNHOME) # set cursor position to zero
- self.delayMicroseconds(3000) # this command takes a long time!
-
-
- def clear(self):
-
- self.write4bits(self.LCD_CLEARDISPLAY) # command to clear display
- self.delayMicroseconds(3000) # 3000 microsecond sleep, clearing the display takes a long time
-
-
- def setCursor(self, col, row):
-
- self.row_offsets = [ 0x00, 0x40, 0x14, 0x54 ]
-
- if ( row > self.numlines ):
- row = self.numlines - 1 # we count rows starting w/0
-
- self.write4bits(self.LCD_SETDDRAMADDR | (col + self.row_offsets[row]))
-
-
- def noDisplay(self):
- """ Turn the display off (quickly) """
-
- self.displaycontrol &= ~self.LCD_DISPLAYON
- self.write4bits(self.LCD_DISPLAYCONTROL | self.displaycontrol)
-
-
- def display(self):
- """ Turn the display on (quickly) """
-
- self.displaycontrol |= self.LCD_DISPLAYON
- self.write4bits(self.LCD_DISPLAYCONTROL | self.displaycontrol)
-
-
- def noCursor(self):
- """ Turns the underline cursor on/off """
-
- self.displaycontrol &= ~self.LCD_CURSORON
- self.write4bits(self.LCD_DISPLAYCONTROL | self.displaycontrol)
-
-
- def cursor(self):
- """ Cursor On """
-
- self.displaycontrol |= self.LCD_CURSORON
- self.write4bits(self.LCD_DISPLAYCONTROL | self.displaycontrol)
-
-
- def noBlink(self):
- """ Turn on and off the blinking cursor """
-
- self.displaycontrol &= ~self.LCD_BLINKON
- self.write4bits(self.LCD_DISPLAYCONTROL | self.displaycontrol)
-
-
- def noBlink(self):
- """ Turn on and off the blinking cursor """
-
- self.displaycontrol &= ~self.LCD_BLINKON
- self.write4bits(self.LCD_DISPLAYCONTROL | self.displaycontrol)
-
-
- def DisplayLeft(self):
- """ These commands scroll the display without changing the RAM """
-
- self.write4bits(self.LCD_CURSORSHIFT | self.LCD_DISPLAYMOVE | self.LCD_MOVELEFT)
-
-
- def scrollDisplayRight(self):
- """ These commands scroll the display without changing the RAM """
-
- self.write4bits(self.LCD_CURSORSHIFT | self.LCD_DISPLAYMOVE | self.LCD_MOVERIGHT);
-
-
- def leftToRight(self):
- """ This is for text that flows Left to Right """
-
- self.displaymode |= self.LCD_ENTRYLEFT
- self.write4bits(self.LCD_ENTRYMODESET | self.displaymode);
-
-
- def rightToLeft(self):
- """ This is for text that flows Right to Left """
- self.displaymode &= ~self.LCD_ENTRYLEFT
- self.write4bits(self.LCD_ENTRYMODESET | self.displaymode)
-
-
- def autoscroll(self):
- """ This will 'right justify' text from the cursor """
-
- self.displaymode |= self.LCD_ENTRYSHIFTINCREMENT
- self.write4bits(self.LCD_ENTRYMODESET | self.displaymode)
-
-
- def noAutoscroll(self):
- """ This will 'left justify' text from the cursor """
-
- self.displaymode &= ~self.LCD_ENTRYSHIFTINCREMENT
- self.write4bits(self.LCD_ENTRYMODESET | self.displaymode)
-
-
- def write4bits(self, bits, char_mode=False):
- """ Send command to LCD """
-
- self.delayMicroseconds(1000) # 1000 microsecond sleep
-
- bits=bin(bits)[2:].zfill(8)
-
- self.GPIO.output(self.pin_rs, char_mode)
-
- for pin in self.pins_db:
- self.GPIO.output(pin, False)
-
- for i in range(4):
- if bits[i] == "1":
- self.GPIO.output(self.pins_db[::-1][i], True)
-
- self.pulseEnable()
-
- for pin in self.pins_db:
- self.GPIO.output(pin, False)
-
- for i in range(4,8):
- if bits[i] == "1":
- self.GPIO.output(self.pins_db[::-1][i-4], True)
-
- self.pulseEnable()
-
-
- def delayMicroseconds(self, microseconds):
- seconds = microseconds / float(1000000) # divide microseconds by 1 million for seconds
- sleep(seconds)
-
-
- def pulseEnable(self):
- self.GPIO.output(self.pin_e, False)
- self.delayMicroseconds(1) # 1 microsecond pause - enable pulse must be > 450ns
- self.GPIO.output(self.pin_e, True)
- self.delayMicroseconds(1) # 1 microsecond pause - enable pulse must be > 450ns
- self.GPIO.output(self.pin_e, False)
- self.delayMicroseconds(1) # commands need > 37us to settle
-
-
- def message(self, text):
- """ Send string to LCD. Newline wraps to second line"""
-
- for char in text:
- if char == '\n':
- self.write4bits(0xC0) # next line
- else:
- self.write4bits(ord(char),True)
-
-
-if __name__ == '__main__':
-
- lcd = Adafruit_CharLCD()
-
- lcd.clear()
- lcd.message(" Adafruit 16x2\n Standard LCD")
-
diff --git a/Adafruit_CharLCD/Adafruit_CharLCD_IPclock_example.py b/Adafruit_CharLCD/Adafruit_CharLCD_IPclock_example.py
deleted file mode 100755
index d3f6958f..00000000
--- a/Adafruit_CharLCD/Adafruit_CharLCD_IPclock_example.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/python
-
-from Adafruit_CharLCD import Adafruit_CharLCD
-from subprocess import *
-from time import sleep, strftime
-from datetime import datetime
-
-lcd = Adafruit_CharLCD()
-
-cmd = "ip addr show eth0 | grep inet | awk '{print $2}' | cut -d/ -f1"
-
-lcd.begin(16,1)
-
-def run_cmd(cmd):
- p = Popen(cmd, shell=True, stdout=PIPE)
- output = p.communicate()[0]
- return output
-
-while 1:
- lcd.clear()
- ipaddr = run_cmd(cmd)
- lcd.message(datetime.now().strftime('%b %d %H:%M:%S\n'))
- lcd.message('IP %s' % ( ipaddr ) )
- sleep(2)
diff --git a/Adafruit_CharLCD/Adafruit_I2C.py b/Adafruit_CharLCD/Adafruit_I2C.py
deleted file mode 120000
index 77f06164..00000000
--- a/Adafruit_CharLCD/Adafruit_I2C.py
+++ /dev/null
@@ -1 +0,0 @@
-../Adafruit_I2C/Adafruit_I2C.py
\ No newline at end of file
diff --git a/Adafruit_CharLCDPlate/Adafruit_CharLCDPlate.py b/Adafruit_CharLCDPlate/Adafruit_CharLCDPlate.py
deleted file mode 100644
index 12e4cdf8..00000000
--- a/Adafruit_CharLCDPlate/Adafruit_CharLCDPlate.py
+++ /dev/null
@@ -1,303 +0,0 @@
-#!/usr/bin/pythonhttp://raspberrypi.local/editor
-
-#
-# based on code from lrvick and LiquidCrystal
-# lrvic - https://github.com/lrvick/raspi-hd44780/blob/master/hd44780.py
-# LiquidCrystal - https://github.com/arduino/Arduino/blob/master/libraries/LiquidCrystal/LiquidCrystal.cpp
-#
-
-from time import sleep
-from Adafruit_I2C import Adafruit_I2C
-from Adafruit_MCP230xx import Adafruit_MCP230XX
-import smbus
-
-
-class Adafruit_CharLCDPlate:
-
- OUTPUT = 0
- INPUT = 1
-
- # LED colors
- RED = 0x01
- GREEN = 0x02
- BLUE = 0x04
- YELLOW = 0x03
- TEAL = 0x06
- VIOLET = 0x05
- ON = 0x07
- OFF = 0x0
-
- # buttons
- SELECT = 0
- RIGHT = 1
- DOWN = 2
- UP = 3
- LEFT = 4
-
- # commands
- LCD_CLEARDISPLAY = 0x01
- LCD_RETURNHOME = 0x02
- LCD_ENTRYMODESET = 0x04
- LCD_DISPLAYCONTROL = 0x08
- LCD_CURSORSHIFT = 0x10
- LCD_FUNCTIONSET = 0x20
- LCD_SETCGRAMADDR = 0x40
- LCD_SETDDRAMADDR = 0x80
-
- # flags for display entry mode
- LCD_ENTRYRIGHT = 0x00
- LCD_ENTRYLEFT = 0x02
- LCD_ENTRYSHIFTINCREMENT = 0x01
- LCD_ENTRYSHIFTDECREMENT = 0x00
-
- # flags for display on/off control
- LCD_DISPLAYON = 0x04
- LCD_DISPLAYOFF = 0x00
- LCD_CURSORON = 0x02
- LCD_CURSOROFF = 0x00
- LCD_BLINKON = 0x01
- LCD_BLINKOFF = 0x00
-
- # flags for display/cursor shift
- LCD_DISPLAYMOVE = 0x08
- LCD_CURSORMOVE = 0x00
-
- # flags for display/cursor shift
- LCD_DISPLAYMOVE = 0x08
- LCD_CURSORMOVE = 0x00
- LCD_MOVERIGHT = 0x04
- LCD_MOVELEFT = 0x00
-
- # flags for function set
- LCD_8BITMODE = 0x10
- LCD_4BITMODE = 0x00
- LCD_2LINE = 0x08
- LCD_1LINE = 0x00
- LCD_5x10DOTS = 0x04
- LCD_5x8DOTS = 0x00
-
-
-
-
- def __init__(self, busnum=0, pin_rs=15, pin_e=13, pins_db=[12, 11, 10, 9], pin_rw=14):
- self.pin_rs = pin_rs
- self.pin_e = pin_e
- self.pin_rw = pin_rw
- self.pins_db = pins_db
-
- self.mcp = Adafruit_MCP230XX(busnum = busnum, address = 0x20, num_gpios = 16)
-
- self.mcp.config(self.pin_e, self.OUTPUT)
- self.mcp.config(self.pin_rs, self.OUTPUT)
- self.mcp.config(self.pin_rw, self.OUTPUT)
- self.mcp.output(self.pin_rw, 0)
- self.mcp.output(self.pin_e, 0)
-
- for pin in self.pins_db:
- self.mcp.config(pin, self.OUTPUT)
-
- self.write4bits(0x33) # initialization
- self.write4bits(0x32) # initialization
- self.write4bits(0x28) # 2 line 5x7 matrix
- self.write4bits(0x0C) # turn cursor off 0x0E to enable cursor
- self.write4bits(0x06) # shift cursor right
-
- self.displaycontrol = self.LCD_DISPLAYON | self.LCD_CURSOROFF | self.LCD_BLINKOFF
-
- self.displayfunction = self.LCD_4BITMODE | self.LCD_1LINE | self.LCD_5x8DOTS
- self.displayfunction |= self.LCD_2LINE
-
- """ Initialize to default text direction (for romance languages) """
- self.displaymode = self.LCD_ENTRYLEFT | self.LCD_ENTRYSHIFTDECREMENT
- self.write4bits(self.LCD_ENTRYMODESET | self.displaymode) # set the entry mode
-
- # turn on backlights!
- self.mcp.config(6, self.mcp.OUTPUT)
- self.mcp.config(7, self.mcp.OUTPUT)
- self.mcp.config(8, self.mcp.OUTPUT)
- self.mcp.output(6, 0) # red
- self.mcp.output(7, 0) # green
- self.mcp.output(8, 0) # blue
-
- # turn on pullups
- self.mcp.pullup(self.SELECT, True)
- self.mcp.pullup(self.LEFT, True)
- self.mcp.pullup(self.RIGHT, True)
- self.mcp.pullup(self.UP, True)
- self.mcp.pullup(self.DOWN, True)
- self.mcp.config(self.SELECT, self.mcp.INPUT)
- self.mcp.config(self.LEFT, self.mcp.INPUT)
- self.mcp.config(self.RIGHT, self.mcp.INPUT)
- self.mcp.config(self.DOWN, self.mcp.INPUT)
- self.mcp.config(self.UP, self.mcp.INPUT)
-
- def begin(self, cols, lines):
- if (lines > 1):
- self.numlines = lines
- self.displayfunction |= self.LCD_2LINE
- self.currline = 0
- self.clear()
-
- def home(self):
- self.write4bits(self.LCD_RETURNHOME) # set cursor position to zero
- self.delayMicroseconds(2000) # this command takes a long time!
-
- def clear(self):
- self.write4bits(self.LCD_CLEARDISPLAY) # command to clear display
- self.delayMicroseconds(2000) # 2000 microsecond sleep, clearing the display takes a long time
-
- def setCursor(self, col, row):
- self.row_offsets = [ 0x00, 0x40, 0x14, 0x54 ]
- if ( row > self.numlines ):
- row = self.numlines - 1 # we count rows starting w/0
- self.write4bits(self.LCD_SETDDRAMADDR | (col + self.row_offsets[row]))
-
- def noDisplay(self):
- """ Turn the display off (quickly) """
- self.displaycontrol &= ~self.LCD_DISPLAYON
- self.write4bits(self.LCD_DISPLAYCONTROL | self.displaycontrol)
-
- def display(self):
- """ Turn the display on (quickly) """
- self.displaycontrol |= self.LCD_DISPLAYON
- self.write4bits(self.LCD_DISPLAYCONTROL | self.displaycontrol)
-
- def noCursor(self):
- """ Turns the underline cursor on/off """
- self.displaycontrol &= ~self.LCD_CURSORON
- self.write4bits(self.LCD_DISPLAYCONTROL | self.displaycontrol)
-
-
- def cursor(self):
- """ Cursor On """
- self.displaycontrol |= self.LCD_CURSORON
- self.write4bits(self.LCD_DISPLAYCONTROL | self.displaycontrol)
-
- def noBlink(self):
- """ Turn on and off the blinking cursor """
- self.displaycontrol &= ~self.LCD_BLINKON
- self.write4bits(self.LCD_DISPLAYCONTROL | self.displaycontrol)
-
- def noBlink(self):
- """ Turn on and off the blinking cursor """
- self.displaycontrol &= ~self.LCD_BLINKON
- self.write4bits(self.LCD_DISPLAYCONTROL | self.displaycontrol)
-
- def DisplayLeft(self):
- """ These commands scroll the display without changing the RAM """
- self.write4bits(self.LCD_CURSORSHIFT | self.LCD_DISPLAYMOVE | self.LCD_MOVELEFT)
-
- def scrollDisplayRight(self):
- """ These commands scroll the display without changing the RAM """
- self.write4bits(self.LCD_CURSORSHIFT | self.LCD_DISPLAYMOVE | self.LCD_MOVERIGHT);
-
- def leftToRight(self):
- """ This is for text that flows Left to Right """
- self.displaymode |= self.LCD_ENTRYLEFT
- self.write4bits(self.LCD_ENTRYMODESET | self.displaymode);
-
- def rightToLeft(self):
- """ This is for text that flows Right to Left """
- self.displaymode &= ~self.LCD_ENTRYLEFT
- self.write4bits(self.LCD_ENTRYMODESET | self.displaymode)
-
- def autoscroll(self):
- """ This will 'right justify' text from the cursor """
- self.displaymode |= self.LCD_ENTRYSHIFTINCREMENT
- self.write4bits(self.LCD_ENTRYMODESET | self.displaymode)
-
- def noAutoscroll(self):
- """ This will 'left justify' text from the cursor """
- self.displaymode &= ~self.LCD_ENTRYSHIFTINCREMENT
- self.write4bits(self.LCD_ENTRYMODESET | self.displaymode)
-
- def write4bits(self, bits, char_mode=False):
- """ Send command to LCD """
- #self.delayMicroseconds(1000) # 1000 microsecond sleep
- bits=bin(bits)[2:].zfill(8)
- self.mcp.output(self.pin_rs, char_mode)
-
- for i in range(4):
- if bits[i] == "1":
- self.mcp.output(self.pins_db[::-1][i], True)
- else:
- self.mcp.output(self.pins_db[::-1][i], False)
- self.pulseEnable()
-
- for i in range(4,8):
- if bits[i] == "1":
- self.mcp.output(self.pins_db[::-1][i-4], True)
- else:
- self.mcp.output(self.pins_db[::-1][i-4], False)
- self.pulseEnable()
-
- def delayMicroseconds(self, microseconds):
- seconds = microseconds / 1000000 # divide microseconds by 1 million for seconds
- sleep(seconds)
-
- def pulseEnable(self):
- self.mcp.output(self.pin_e, True)
- self.delayMicroseconds(1) # 1 microsecond pause - enable pulse must be > 450ns
- self.mcp.output(self.pin_e, False)
- #self.delayMicroseconds(1) # commands need > 37us to settle
-
- def message(self, text):
- """ Send string to LCD. Newline wraps to second line"""
- for char in text:
- if char == '\n':
- self.write4bits(0xC0) # next line
- else:
- self.write4bits(ord(char),True)
-
- def backlight(self, color):
- self.mcp.output(6, not color & 0x01)
- self.mcp.output(7, not color & 0x02)
- self.mcp.output(8, not color & 0x04)
-
- def buttonPressed(self, buttonname):
- if (buttonname > self.LEFT):
- return false
-
- return not self.mcp.input(buttonname)
-
-
-if __name__ == '__main__':
-
- lcd = Adafruit_CharLCDPlate(busnum = 0)
- lcd.clear()
- lcd.message("Adafruit RGB LCD\nPlate w/Keypad!")
- sleep(1)
- while 1:
- if (lcd.buttonPressed(lcd.LEFT)):
- lcd.backlight(lcd.RED)
-
- if (lcd.buttonPressed(lcd.UP)):
- lcd.backlight(lcd.BLUE)
-
- if (lcd.buttonPressed(lcd.DOWN)):
- lcd.backlight(lcd.GREEN)
-
- if (lcd.buttonPressed(lcd.RIGHT)):
- lcd.backlight(lcd.VIOLET)
-
- if (lcd.buttonPressed(lcd.SELECT)):
- lcd.backlight(lcd.ON)
-
-
- while 1:
- lcd.backlight(lcd.RED)
- sleep(1)
- lcd.backlight(lcd.YELLOW)
- sleep(1)
- lcd.backlight(lcd.GREEN)
- sleep(1)
- lcd.backlight(lcd.TEAL)
- sleep(1)
- lcd.backlight(lcd.BLUE)
- sleep(1)
- lcd.backlight(lcd.VIOLET)
- sleep(1)
- lcd.backlight(lcd.ON)
- sleep(1)
- lcd.backlight(lcd.OFF)
- sleep(1)
diff --git a/Adafruit_CharLCDPlate/Adafruit_I2C.py b/Adafruit_CharLCDPlate/Adafruit_I2C.py
deleted file mode 120000
index f5fcefeb..00000000
--- a/Adafruit_CharLCDPlate/Adafruit_I2C.py
+++ /dev/null
@@ -1 +0,0 @@
-../../Adafruit-Raspberry-Pi-Python-Code/Adafruit_I2C/Adafruit_I2C.py
\ No newline at end of file
diff --git a/Adafruit_CharLCDPlate/Adafruit_MCP230xx.py b/Adafruit_CharLCDPlate/Adafruit_MCP230xx.py
deleted file mode 120000
index 4e89f685..00000000
--- a/Adafruit_CharLCDPlate/Adafruit_MCP230xx.py
+++ /dev/null
@@ -1 +0,0 @@
-../../Adafruit-Raspberry-Pi-Python-Code/Adafruit_MCP230xx/Adafruit_MCP230xx.py
\ No newline at end of file
diff --git a/Adafruit_CharLCDPlate/LCDtest.py b/Adafruit_CharLCDPlate/LCDtest.py
deleted file mode 100644
index 3f6177ee..00000000
--- a/Adafruit_CharLCDPlate/LCDtest.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/python
-
-from time import sleep
-from Adafruit_I2C import Adafruit_I2C
-from Adafruit_MCP230xx import Adafruit_MCP230XX
-from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate
-
-import smbus
-
-
-# initialize the LCD plate
-# use busnum = 0 for raspi version 1 (256MB) and busnum = 1 for version 2
-lcd = Adafruit_CharLCDPlate(busnum = 0)
-
-# clear display
-lcd.clear()
-# hello!
-lcd.message("Adafruit RGB LCD\nPlate w/Keypad!")
-sleep(1)
-
-# first loop, just changes the color
-lcd.backlight(lcd.RED)
-sleep(.5)
-lcd.backlight(lcd.YELLOW)
-sleep(.5)
-lcd.backlight(lcd.GREEN)
-sleep(.5)
-lcd.backlight(lcd.TEAL)
-sleep(.5)
-lcd.backlight(lcd.BLUE)
-sleep(.5)
-lcd.backlight(lcd.VIOLET)
-sleep(.5)
-lcd.backlight(lcd.ON)
-sleep(.5)
-lcd.backlight(lcd.OFF)
-sleep(.5)
-
-while 1:
- if (lcd.buttonPressed(lcd.LEFT)):
- lcd.clear()
- lcd.message("Red Red Wine")
- lcd.backlight(lcd.RED)
-
- if (lcd.buttonPressed(lcd.UP)):
- lcd.clear()
- lcd.message("Sita Sings \nthe blues")
- lcd.backlight(lcd.BLUE)
-
- if (lcd.buttonPressed(lcd.DOWN)):
- lcd.clear()
- lcd.message("I see fields\nof green");
- lcd.backlight(lcd.GREEN)
-
- if (lcd.buttonPressed(lcd.RIGHT)):
- lcd.clear()
- lcd.message("Purple mountain\n majesties");
- lcd.backlight(lcd.VIOLET)
-
- if (lcd.buttonPressed(lcd.SELECT)):
- lcd.clear()
- lcd.backlight(lcd.ON)
-
-
diff --git a/Adafruit_DHT_Driver/Adafruit_DHT b/Adafruit_DHT_Driver/Adafruit_DHT
deleted file mode 100755
index 40f4c416..00000000
Binary files a/Adafruit_DHT_Driver/Adafruit_DHT and /dev/null differ
diff --git a/Adafruit_DHT_Driver/Adafruit_DHT.c b/Adafruit_DHT_Driver/Adafruit_DHT.c
deleted file mode 100644
index 9d1746be..00000000
--- a/Adafruit_DHT_Driver/Adafruit_DHT.c
+++ /dev/null
@@ -1,148 +0,0 @@
-// How to access GPIO registers from C-code on the Raspberry-Pi
-// Example program
-// 15-January-2012
-// Dom and Gert
-//
-
-
-// Access from ARM Running Linux
-
-#define BCM2708_PERI_BASE 0x20000000
-#define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) /* GPIO controller */
-
-
-#include
Visit https://circuitpython.org/blinka for more information
+CircuitPython has support for almost 200 different drivers, and a as well as FT232H support for Mac/Win/Linux!
+ +## But I **need** the old code! What can I do? + +Don't worry the old Adafruit Raspberry-Pi Python code can be found in the +[legacy branch](https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/tree/legacy) of this repository. This is a snapshot of the old code before it +was refactored into individual libraries. **Note this legacy code will not be +maintained!**