I am working on some project in which we have to measure the distance between two nearby device using puck.js . if distance is less then a meter . we need to emit LED.
One device is puck.js and other one is ESP32.
Help me to figure out this.
Assuming the ESP32 is advertising, you should be able to use something like:
if (d.addr=="...") LED.write(d.rssi>-70);
You'll need to change the address and probably the RSSI value as well, but that should be a good start :)
Thanks its working
Just a quick note that doing this does use a lot of power (as the radio is always receiving) so will run the battery down quite quickly - so you might want a way of only enabling it when you need it.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem