I have bought a couple "C7210" ultrasound emitter / receiver.
The emitter needs a 40khz pulse, and I would like to analyze the echoed signal on the receiver.
I tried to proceed like this:
C9 => Emitter
C5 => Receiver
( the second pin of emitter and receiver is to GND ).
// wout is the waveform I want to send to the emitter
var wout = new Waveform(256);
for (var i=0;i<256;i++) wout.buffer[i] = 128+Math.sin(i*Math.PI/128)*127;
// win is the waveform I want to record from the receiver
var win = new Waveform(512);
win.on("finish", function(buf) {
drawBuffer(buf); // ( I have a small lcd on which I draw the waveform )
win.startInput(C5,40000,{repeat:false}); // I want to record the next 512 bytes
});
C9.reset();
C5.reset();
// How do I output a 40khz waveform ?
analogWrite(C9,0.5,{ freq:40000}); // pwm at 40khz ?
wout.startOutput(C9, 4000, { repeat:true }); // modulates the pwm ?
// How do I record an analog signal on a pin?
win.startInput(C5,40000,{repeat:false});
Also I am not sure if the 3.3V of the esperuino are enough to make the ultrasound emitter.
So far it looks like I've recorded only parasites. Can the espruino generate and record a 40khz signal? Am I missing something?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I have bought a couple "C7210" ultrasound emitter / receiver.
The emitter needs a 40khz pulse, and I would like to analyze the echoed signal on the receiver.
I tried to proceed like this:
C9 => Emitter
C5 => Receiver
( the second pin of emitter and receiver is to GND ).
Also I am not sure if the 3.3V of the esperuino are enough to make the ultrasound emitter.
So far it looks like I've recorded only parasites. Can the espruino generate and record a 40khz signal? Am I missing something?