Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. func (l *BuzzerDriver) Tone(duration float64, out bool) (err error) {
  2. // Modified by Raul M Crivineanu
  3. if out == true {
  4. return
  5. }
  6. tempo := ((60 / l.BPM) * (duration * 1000))
  7. for i := 0.0; i < tempo*7000; i += 550 {
  8. l.connection.DigitalWrite(l.Pin(), 100)
  9. time.Sleep(time.Duration(duration)*time.Millisecond)
  10. l.connection.DigitalWrite(l.Pin(), 0)
  11. time.Sleep(time.Duration(duration)*time.Millisecond)
  12. }
  13. return
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement