// SetAngle sets the servo angle. func (s *Servo) SetAngle(angle int) error { us := util.Map(int64(angle), 0, 180, int64(s.Minus), int64(s.Maxus)) glog.V(1).Infof("servo: given angle %v calculated %v us", angle, us) return s.PWM.SetMicroseconds(int(us)) }
func (p *pwmPin) SetAnalog(value byte) error { duty := util.Map(int64(value), 0, 255, 0, int64(p.period)) return p.SetDuty(int(duty)) }
// SetAnalog is a convinience method which allows easy manipulation of the PWM // based on a (0-255) range value. func (p *pwmChannel) SetAnalog(value byte) error { offTime := util.Map(int64(value), 0, 255, 0, pwmControlPoints-1) return p.d.SetPwm(p.channel, 0, int(offTime)) }