Documentation ¶
Overview ¶
Package buspirate interfaces with the binary mode of the BusPirate. http://dangerousprototypes.com/docs/Bus_Pirate
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BusPirate ¶
type BusPirate struct {
// contains filtered or unexported fields
}
BusPirate represents a connection to a remote BusPirate device.
func (*BusPirate) PowerOff ¶
func (bp *BusPirate) PowerOff()
PowerOff turns off the 5v and 3v3 regulators.
func (*BusPirate) PowerOn ¶
func (bp *BusPirate) PowerOn()
PowerOn turns on the 5v and 3v3 regulators.
func (*BusPirate) SetPWM ¶
SetPWM enables PWM output on the AUX pin with the specified duty cycle. duty is clamped between [0, 1].
Example ¶
Pulse a LED connected to the AUX pin.
bp, err := buspirate.Open("/dev/ttyACM0") if err != nil { panic(err) } duty := 0.1 delta := 0.1 for { bp.SetPWM(duty) time.Sleep(50 * time.Millisecond) duty += delta if duty > 1.0 { duty = 1.0 delta = -delta } if duty < 0 { duty = 0.0 delta = -delta } }
Output:
Click to show internal directories.
Click to hide internal directories.