LusoRobótica - Robótica em Português
Sistemas específicos => Arduino / AVR => Tópico iniciado por: ghostbuster em 07 de Setembro de 2009, 21:17
-
Encontrei este esquema na net e queria fazer isso com o arduino.. ou seja tenho que gerar sinal de 40khz a partir de dois pinos do arduino, alguem me sabe dizer como faço isso? ja tenho os 4 tranzistores e transducer ultrasonico mas de momento nao tenho nenhum 555 em casa
http://electroschematics.com/wp-content/uploads/2009/01/dog-repellent.jpg
-
qual esquema?
-
posta o esquema, ao menos tens transistores?
-
acho que é isso q o amigo qria mostrar não
http://electroschematics.com/37/electronic-dog-repellent-dog-chaser-schematic
se for esse mesmo o que da pra fazer com o arduino é o seguinte pegue esse exemplo e altere a nota
http://www.arduino.cc/playground/Portugues/LearningMelody
int speakerPin = 9;
int length = 15; // número de notas
char notes[] = "ccggaagffeeddc "; // espaços representam pausas
int beats[] = { 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 4 };
int tempo = 300;
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tone);
}
}
void playNote(char note, int duration) {
char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 };
// toque o tom correspondente ao nome da nota
for (int i = 0; i < 8; i++) {
if (names == note) {
playTone(tones, duration);
}
}
}
void setup() {
pinMode(speakerPin, OUTPUT);
}
void loop() {
for (int i = 0; i < length; i++) {
if (notes == ' ') {
delay(beats * tempo); // rest
} else {
playNote(notes, beats * tempo);
}
// pausa entre notas
delay(tempo / 2);
}
}