#include "Arduino.h"
#include "TZ51_playtone.h"

void playTone(int pintone,int freq, int duration) {
 int tone=500000/freq;
 for (long i = 0; i < duration * 1000L; i += tone * 2) {
 digitalWrite(pintone, HIGH);
 delayMicroseconds(tone);
 digitalWrite(pintone, LOW);
 delayMicroseconds(tone);
 }
}