attrezzaggio
pin11˜ _altoparlante
pin9˜ _trigger
pin8 _receiver
variabili
X = 0
duration = 0
distance = 0
ciclo
SWITCH ON (5 Volt)
_trigger
wait
10 milliseconds
SWITCH OFF (0 Volt)
_trigger
in the variable
duration put the duration of the pulse on the pin:
_receiver
the variable distanza is equal to the formula duration*0.1720
write on the serial:
_distanza_(mm)= distanza
wait
100 milliseconds
the variable X is equal to the formula distance*10
write on the serial:
_-_-_-_frequenza= X
PLAY the note
di frequenza (XHz) duration:
100 milliseconds