Skip to main content

A class for interacting with K8090 or VM8090 relay boards

Project description

K8090

A module for interacting with the K8090 and VM8090 relay boards.

Installation

To install the module, run the following command:

pip install k8090

Example

# Import relay_card from k8090
import time
from k8090 import relay_card

# Connecting to card
card = relay_card.connect('/dev/tty.usbmodem11301')

# Doing factory reset
card.factory_reset()

# Reading information about card
print(f'Firmware version: {card.firmware_version}')
print(f'Jumper status: {card.jumper_status}\n')

# Copying relay 4 into a variable
relay_4 = card.relays[3]

# Toggle relay 4
relay_4.on()
card.relays[3].off()
relay_4.toggle()
card.relays[3].toggle()

# Turn on relay 4 and then turn off after 10 seconds
relay_4.delay = 10
relay_4.timer()

# Getting status of all relays
for relay in card.relays:
    print(f'Relay number: {relay.id+1}')
    print(f'Relay status: {relay.status}')
    print(f'Relay delay: {relay.delay}')
    print(f'Timer is active: {relay.timer_is_active}\n')

print(f'Relay 4 delay: {relay_4.delay}')

# Copying button 4 into a variable
button_4 = card.buttons[3]

# Changing mode of button 4 to momentary
button_4.mode = card.Button.MOMENTARY

# Getting status of button 1 every second for 10 seconds
button_1 = card.buttons[0]
for _ in range(10):
    print(f'Button 1 pressed: {button_1.pressed}')
    print(f'Button 1 mode: {button_1.mode}')
    print(f'Button 1 last action: {button_1.action}\n')
    time.sleep(1)

# Getting status of all buttons
for button in card.buttons:
    print(f'Button number: {button.id+1}')
    print(f'Button 1 pressed: {button.pressed}')
    print(f'Button 1 mode: {button.mode}')
    print(f'Button 1 last action: {button.action}\n')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

k8090-1.0.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

k8090-1.0.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file k8090-1.0.0.tar.gz.

File metadata

  • Download URL: k8090-1.0.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for k8090-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4fdbee9d64ef7b00bf32072fa701dc0b30864d24baad2a377f73efd3f24ccf65
MD5 7a3b0681dae79adc5316ec4e95ed5ade
BLAKE2b-256 081cece4baf0ef4110e2e3a79ef44007ca0fc37abf9632df634aca439191bdda

See more details on using hashes here.

File details

Details for the file k8090-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: k8090-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for k8090-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd371527aefcf4b18c5b60534bf9e59399ea77740a46b02f0602401b6f28d9c5
MD5 f2804c4975a2ff3a54562af46c7d1f4f
BLAKE2b-256 2b103b6ef8737c50f98199b66bdf020825f095d529c4e59f184dc7c6292f650d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page