DRAWDIO
#include <EducationShield.h>
#include "pitches.h"
CapacitiveSwitch me=CapacitiveSwitch(2,3);
Melody speaker=Melody(8);
int lowerThreshold=200;
int upperThreshold=1100;
int toneLow=NOTE_C3;
int toneHigh=NOTE_B6;
void setup(){
}
void loop(){
int value=me.getValue(lowerThreshold);
int pitch;
if(value>0){
pitch=map(value,lowerThreshold,upperThreshold,toneLow,toneHigh);
}else{
pitch=0;
}
speaker.playTone(pitch,10);
}
Comentarios
Publicar un comentario