Documentation ¶
Index ¶
Constants ¶
View Source
const ( I2cWrite = iota + 1 I2cRead I2cWriteRead I2cGet )
Variables ¶
View Source
var DefaultLedSequence = LedSequence{ Circle: true, Bounce: false, NumLeds: 15, PeakRadius: 4, SleepTime: 50 * time.Millisecond, PeakTravelTime: 1300 * time.Millisecond, }
View Source
var DefaultTank = Tank{ UsbDevice: "", I2cFreq: uint(400), I2cRequestQueue: 20, Motors: MainMotors{ I2cAddr: pca9685.ADDRESS, PwmStart: pca9685.LED0, InvertLeftDir: false, InvertRightDir: false, }, Leds: MainLeds{ I2cAddr: pca9685.ADDRESS + 4, PwmStart: pca9685.LED0, NumLeds: 15, PwmOutput: pca9685.PwmOutput{ ValuesFrom: 0, ValuesTo: 0.7, }, }, Adc: Adc{ I2cAddr: ads1115.ADDR_GND, BatteryMin: 2.60, BatteryMax: 3.24, }, }
Functions ¶
This section is empty.
Types ¶
type Adc ¶
type Adc struct { BatteryMin float64 BatteryMax float64 I2cAddr byte Dummy bool SkipInit bool // contains filtered or unexported fields }
func (*Adc) ConvertVoltageToPercentage ¶
func (*Adc) GetBatteryPercentage ¶
func (*Adc) GetBatteryVoltage ¶
type I2cRequest ¶
type I2cRequest struct { Type int Addr byte DataWrite []byte DataRead []byte GetRegister byte // Only for I2cGet GetSize int // Only for I2cGet Error error // contains filtered or unexported fields }
func (*I2cRequest) Wait ¶
func (r *I2cRequest) Wait()
type LedSequence ¶
type MainLeds ¶
type MainLeds struct { I2cAddr byte Dummy bool SkipInit bool NumLeds int PwmStart byte // pca9685.LED0 PwmOutput pca9685.PwmOutput // contains filtered or unexported fields }
func (*MainLeds) DisableAll ¶
type MainMotors ¶
type MainMotors struct { I2cAddr byte Dummy bool SkipInit bool InvertRightDir, InvertLeftDir bool // Starting from the first PWM output, the order of outputs must be: // Right Direction, Right Speed, Left Direction, Left Speed PwmStart byte // pca9685.LED0 // contains filtered or unexported fields }
func (*MainMotors) ForceSet ¶
func (m *MainMotors) ForceSet(left, right float64) error
func (*MainMotors) Init ¶
func (m *MainMotors) Init() error
func (*MainMotors) Set ¶
func (m *MainMotors) Set(left, right float64) error
Input values in -100..100
type SmoothMotor ¶
type SmoothMotor struct {
// contains filtered or unexported fields
}
func (*SmoothMotor) GetSpeed ¶
func (m *SmoothMotor) GetSpeed() float32
func (*SmoothMotor) SetSpeed ¶
func (m *SmoothMotor) SetSpeed(val float32)
type SmoothTank ¶
type SmoothTank struct { Tank SleepTime time.Duration AccelSlopeTime time.Duration DecelSlopeTime time.Duration MinSpeed float64 // contains filtered or unexported fields }
func (*SmoothTank) Cleanup ¶
func (a *SmoothTank) Cleanup()
func (*SmoothTank) Left ¶
func (a *SmoothTank) Left() Motor
func (*SmoothTank) RegisterFlags ¶
func (a *SmoothTank) RegisterFlags()
func (*SmoothTank) Right ¶
func (a *SmoothTank) Right() Motor
func (*SmoothTank) Setup ¶
func (a *SmoothTank) Setup() error
type Tank ¶
type Tank struct { UsbDevice string I2cFreq uint I2cRequestQueue int NoI2cSequencer bool Dummy bool SkipInit bool Motors MainMotors Leds MainLeds Adc Adc // contains filtered or unexported fields }
func (*Tank) InitI2cPeripherals ¶
func (*Tank) RegisterFlags ¶
func (t *Tank) RegisterFlags()
Click to show internal directories.
Click to hide internal directories.