py-fthat Python API

Getting started with py-fthat is easy. The main class you need to care about is BaseFtTxPiHat

fthat.ftpi

Python client to communicate with a fthat on a raspberry pi. See https://tx-pi.de/de/hat/

It uses the gpiozerro library and pigpio.

Based on: https://github.com/heuer/ftdu/

class fthat.ftpi.BaseFtTxPiHat(host='ft-pi4.local')

A dummy docstring.

property host

A dummy docstring.

ultrasonic_enable(enable)

A dummy docstring.

ultrasonic_get()

A dummy docstring.

class fthat.ftpi.FtButton(*args, **kwargs)
class fthat.ftpi.FtMotor(*args, **kwargs)
Resolution of encoder:
  • motor: 3 pulses (6 pulses when counting 0-1 and 1-0 edge) per round.

  • gear shaft: 63.9/127.8 pulses per round.

Parameters
  • name (string) – Motor name, i.e. ‘M1’. The motor name is case-insensitive.

  • pwm (bool) – If True (the default), the motor controller pins, allowing both direction and variable speed control. If False allowing only direction control.

  • encoder (FtButton or False) – If False (the default), no encoder is set. If FtButton i.e. I1. The input will count the rounds.

  • distance – If distance is greater then 0, the motor will break on reaching round at gear shaft. If distance is 0, the motor round infinit.

backward(*args, **kwargs)

Drive the motor backwards.

Parameters

speed (float) – The speed at which the motor should turn. Can be any value between 0 (stopped) and the default 1 (maximum speed) if pwm was True when the class was constructed (and only 0 or 1 if not).

brake()

A dummy docstring.

forward(*args, **kwargs)

Drive the motor forwards.

Parameters

speed (float) – The speed at which the motor should turn. Can be any value between 0 (stopped) and the default 1 (maximum speed) if pwm was True when the class was constructed (and only 0 or 1 if not).

property gear_counter

A dummy docstring.

stop()

Stop the motor.

class fthat.ftpi.Inputs(*args, **kwargs)