Ejemplo n.º 1
0
 def test_platform_pin_count(self):
   self.assertEqual(m.getPinCount(), PLATFORM_PINCOUNT, "Wrong number of pins reported by platform")
Ejemplo n.º 2
0
import mraa

mraa.init()
print(mraa.getPinCount())
print(mraa.getVersion())
print("Raw adc bits: " + str(mraa.adcRawBits()))
print("Support adc bits: " + str(mraa.adcSupportedBits()))
count = 0
while (count < 100):
    try:
        #There is no adcs on this dragonboard. wtf!! even from 0 to 100
        print("Reading I2c" + str(count))
        port = mraa.I2c(count)
        print("Trying to read I2c" + str(count))
        port.dir(mraa.DIR_IN)
        a = port.read(count)

        if (a / 255 * 100 > 90):
            pass  #BOTTLE IF FULL
        elif (a / 255 * 100 < 50):
            pass  #BOTTLE IS HALF FULL
        elif (a / 255 * 100 < 25):
            pass  #YOU MIGHT WANNA CONSIDER REFILL THE MEDICINE
        elif (a / 255 * 100 < 10):
            pass  #TIME TO GO GET MEDICATION
        print("Got a I2c" + str(count) + " of " + str(a))
    except:
        print("Are you sure you have an I2c" + str(count))
    count = count + 1
Ejemplo n.º 3
0
 def test_mraa_check_platform_no_of_pins(self):
     pinCount = m.getPinCount()
     self.assertEqual(pinCount, 20,
                      "Wrong number. of pins. Check platform ...")
Ejemplo n.º 4
0
 def test_platform_pin_count(self):
     self.assertEqual(m.getPinCount(), PLATFORM_PINCOUNT,
                      "Wrong number of pins reported by platform")
Ejemplo n.º 5
0
 def test_mraa_check_platform_no_of_pins(self):
     pinCount = m.getPinCount()
     self.assertEqual(pinCount, 20, "Wrong number. of pins. Check platform ...")
Ejemplo n.º 6
0
 def test_mraa_check_platform_no_of_pins(self):
   self.p_no_of_pins = m.getPinCount()
   print "Platform no. of pins: " + str(self.p_no_of_pins)
   self.assertEqual(self.p_no_of_pins, 20, "Wrong no. of pins. Check platform ...")