lfdebrux / rogue-code

Automatically exported from code.google.com/p/rogue-code
0 stars 0 forks source link

Enhancement: Synchronize tone with external signal #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The ability to synchronize tones with an external signal is extremely critical 
in some applications.  I've attached a patch to the Tone Library that permits 
this functionality by calling a new "sync" routine from an interrupt.  A simple 
usage example follows:

---
Tone tone1;

void setup(void)
{
  tone1.begin(OUTPUT_PIN);
  tone1.play(FREQUENCY_OUT);
  attachInterrupt(0, sync_risingedge, RISING);
}

void sync_risingedge(void)
{
  tone1.sync();
}

void loop(void)
{
}

---

Original issue reported on code.google.com by compho...@gmail.com on 22 Apr 2011 at 7:47

Attachments: