Skip to main content

A python library to operate 'Speed' devices

Project description

Tutorial

Using the SpeedLib librairie

A python library to operate Speed devices.

Currently the API has an unique backend allowing to control miniature devices like the Faller (c) Crane or DCC trains.

Examples ^^^^^^^^

Controlling a Faller (c) crane model

>>> from speedlib.cranes import faller
>>> from speedlib.cranes.faller import Crane
>>> ip_1 = "172.17.217.217"
>>> ip_2 = "172.17.217.217"
>>> crane_1 = Crane()
>>> crane_2 = Crane()
>>> crane_1.init(ip_0)
>>> crane_2.init(ip_2)
>>> crane_2.start_for(20*faller.ureg.millisecond,faller.MotorChassis,faller.MotorDirectionForward)
>>> crane_1.change_speed(faller.MotorCrab, -40)

Controlling a DCC train model

>>> from speedlib.dcc import dcc_object, dcc_trains
>>> from speedlib.dcc.dcc_object import DCCObject
>>>from speedlib.dcc .dcc_trains import Train

>>> train = Train("DCC15",15)
>>> dcc_object.start()
>>> train.speed = 14
>>> train.faster()
>>> train.slower()
>>> train.fl_light = True
>>> print(train)
>>> train.f2 = False
>>> dcc_object.stop()

Controlling a DCC Switch model

>>> from speedlib.dcc import dcc_object, dcc_switches
>>> from speedlib.dcc.dcc_object import DCCObject
>>>from speedlib.dcc .dcc_switches import Switch

>>> SS = Switch("DCC",3, 1)
>>> dcc_object.start()
>>> print(S.biais)
>>> S.biais = True
>>> S.set_biais_id(2)
>>> S.biais = True
>>> S.biais = False
>>> dcc_object.stop()

You can find more examples in the examples directory.

Install

git clone https://github.com/CRIStAL-PADR/Speed.git

The library is in speedlib/init.py

Tests

To starts the unit tests you can do:

cd tests/ >>> PYTHONPATH=../ python3 -m unittest

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

speedlib-2.3.7.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

speedlib-2.3.7-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file speedlib-2.3.7.tar.gz.

File metadata

  • Download URL: speedlib-2.3.7.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10

File hashes

Hashes for speedlib-2.3.7.tar.gz
Algorithm Hash digest
SHA256 4dfaa97d52817ac7858e639eff2f3921ed4236dc2212f356bbdf09f99a30145c
MD5 cc425bd7b15bb3249b72e2a5fb46d9dd
BLAKE2b-256 ee407eb4ecfd14a480905496d2a8360020eba337d95f9f0491714a16f448d607

See more details on using hashes here.

File details

Details for the file speedlib-2.3.7-py3-none-any.whl.

File metadata

  • Download URL: speedlib-2.3.7-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10

File hashes

Hashes for speedlib-2.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4c4c8724edc3d9edef2401482ec9942e1e570171a9b7ce5deb4105e75f38a5d2
MD5 8b5468dcded791177191704f2b238014
BLAKE2b-256 3aafc125122d51386a1bc84ad641332299022c11433f17770b8d3f80f8bbc61f

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