import unittest import math from iseprobe import iseprobe mv = iseprobe(0x3f, -1, 5, 4) class TestMethods(unittest.TestCase): def test_version(self): self.assertEqual(mv.getVersion(), 0x1a) def test_use_temp_comp_true(self): mv.useTemperatureCompensation(True) self.assertEqual(mv.usingTemperatureCompensation(), True) def test_use_temp_comp_false(self): mv.useTemperatureCompensation(False) self.assertEqual(mv.usingTemperatureCompensation(), False) def test_use_dual_point_true(self): mv.useDualPoint(True) self.assertEqual(mv.usingDualPoint(), True) def test_use_dual_point_false(self): mv.useDualPoint(False) self.assertEqual(mv.usingDualPoint(), False) def test_reference_low(self): mv.setDualPointCalibration(1.01, 0, 0, 0) self.assertEqual(mv.getCalibrateLowReference(), 1.01)
import unittest import math from iseprobe import iseprobe mv = iseprobe(0x3f, 3) class TestMethods(unittest.TestCase): def test_version(self): self.assertEqual(mv.getVersion(), 0x1a) def test_use_temp_comp_true(self): mv.useTemperatureCompensation(True) self.assertEqual(mv.usingTemperatureCompensation(), True) def test_use_temp_comp_false(self): mv.useTemperatureCompensation(False) self.assertEqual(mv.usingTemperatureCompensation(), False) def test_use_dual_point_true(self): mv.useDualPoint(True) self.assertEqual(mv.usingDualPoint(), True) def test_use_dual_point_false(self): mv.useDualPoint(False) self.assertEqual(mv.usingDualPoint(), False) def test_reference_low(self): mv.setDualPointCalibration(1.01, 0, 0, 0) self.assertEqual(mv.getCalibrateLowReference(), 1.01)
from iseprobe import iseprobe # connect board SCL to pin 5, SDA to pin 4, but any pins can be used. -1 indicates software I2C. mv = iseprobe(sda=19, scl=23) mv.measuremV() print("mV: " + str(mv.mV))
import cmd from iseprobe import iseprobe # connect board SCL to pin 5, SDA to pin 4, but any pins can be used. -1 indicates software I2C. ise = iseprobe(0x3f, -1, scl=5, sda=4) class iseshell(cmd.Cmd): prompt = '> ' def do_config(self, a): """prints out all the configuration data\nparameters: none""" print("config: ") print("\toffset: " + str(ise.getCalibrateOffset())) print("\tdual point: " + str(ise.usingDualPoint())) print("\tlow reference / read: " + str(ise.getCalibrateLowReference()) + " / " + str(ise.getCalibrateLowReading())) print("\thigh reference / reading: " + str(ise.getCalibrateHighReference()) + " / " + str(ise.getCalibrateHighReading())) print("\ttemp. compensation: " + str(ise.usingTemperatureCompensation())) print("\tversion: " + (hex(ise.getVersion()))) def do_reset(self, a): """reset all saved values\nparameters: none""" ise.reset() def do_temp(self, a):
import cmd from iseprobe import iseprobe ise = iseprobe(0x4f, 3) class iseshell(cmd.Cmd): prompt = '> ' def do_config(self, a): """prints out all the configuration data\nparameters: none""" print("config: ") print("\toffset: " + str(ise.getCalibrateOffset())) print("\tdual point: " + str(ise.usingDualPoint())) print("\tlow reference / read: " + str(ise.getCalibrateLowReference()) + " / " + str(ise.getCalibrateLowReading())) print("\thigh reference / reading: " + str(ise.getCalibrateHighReference()) + " / " + str(ise.getCalibrateHighReading())) print("\ttemp. compensation: " + str(ise.usingTemperatureCompensation())) print("\tversion: " + (hex(ise.getVersion()))) def do_reset(self, a): """reset all saved values\nparameters: none""" ise.reset() def do_temp(self, a): """measures the temperature\nparameters: none"""