skip to content »

learn-flash.ru

Modio not updating

| | Get Digital In(self, digital_in) | Return value for digital in.

modio not updating-71modio not updating-22modio not updating-48

| | Raises: | Value Error if an invalid digital in number is passed.Help on module modio: NAME modio - Utility functions and classes to handle olimex mod-io from python. If not, you may have problems with the firmware, power supply or connection of mod-io. | | Args: | new_address: int, 0 - 0xff, the new address to be assigned | to modio.FILE DESCRIPTION SETUP ===== Before using this code, you need to make sure mod-io is configured and working on your system. i2c-dev i2c_bcm2708 baudrate=50000 2) once /etc/modules has been edited, run: $ sudo service kmod start to load all the modules. 3) make sure debugging tools and libraries are installed: $ sudo apt-get install i2c-tools python-smbus 3) verify that mod-io is accessible, and to which bus it is connected. | | Raises: | Value Error, if the new_address is invalid.Assuming you have a debian based system (like ubuntu or raspbian): 1) edit /etc/modules, by running 'sudo -s' and opening the file with your favourite editor. You need to run $ sudo i2cdetect -y X with X being 0 or 1. If you see a 58 (assuming you did not change the default address of mod-io) in the output, you found the right bus. If you don't see 58 anywhere, do you see some other number? | | Close Contact Relay(self, relay) | Close Contact a specific relay. $ sudo i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- Check status of bus 1. 2) Import it with 'import modio' or 'from modio import modio' if you left the whole directory. Examples: from modio import modio # BUS Number is the bus you found during setup, see instructions above! Device(bus=1) # Take control of the first relay (number 1 on board) relay = modio. | | Methods defined here: | | Change Address(self, new_address) | Changes the address of modio. $ sudo i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- 58 -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- HOW TO USE THE LIBRARY ====================== 1) Copy the file or the whole directory next to your script, or somewhere in PYTHONPATH. =============================== Check out the wiki here: https://github.com/ccontavalli/python-olimex-modio/wiki File problems, issues or other requests here: https://github.com/ccontavalli/python-olimex-modio/issues Newer versions of the code are available here: https://github.com/ccontavalli/python-olimex-modio CLASSES __builtin__.object Device Digital In Fake Bus Relay Smb Bus exceptions. Environment Error) Device Not Found Exception SMBBus Not Configured Properly class Device(__builtin__.object) | Represents a mod-io device, allows to perform common operations.

Read which extra features the firmware supports :) 2. (thanks to Imran for the patches, https://github.com/emnuu) PROBLEMS, ISSUES, or QUESTIONS?

Is Closed(): print "Relay is on" else: print "Relay is off" # Turn it off! Open Contact() MODIFIED FIRMWARE ================= If you have a mod-io and would like some extra features from your board you can install a modified firmware available here: https://github.com/ccontavalli/olimex-modio-firmware This firmware allows you to: 1.

| | Args: | relay: int, 1 - 4, the relay to enable. | | Raises: | Value Error if an invalid relay number is passed.

| | Returns: | False if the digital in is low, True if high.

| | Get Digital Ins(self) | Reads the values of digital in register.

| | Get Read Ain Command(self, ain) | Returns the command to use to read an analogic input.