More NodeMCU magic! A studfinder. It sounds like a geiger counter. I added an antenna to explain electromagnetic waves / interferrence to my wife. It was fun sticking it to my tongue and pretending it hurts.
Read more to see code snippets and whatnot.
Well you must be a curious type. Here ya go.
let isOn = false;
const interval = 0;
var count = 0;
function main()
{
function toggleLights()
{
isOn = !isOn;
digitalWrite(D2, isOn);
digitalWrite(D3, isOn);
digitalWrite(D4, isOn);
}
setInterval(() =>
{
count++;
analogInput = Math.round(analogRead() * 10000);
if (count > 200)
{
count = 0;
console.log(analogInput);
}
if (analogInput > 100)
{
isOn = false;
}
else
{
isOn = true;
}
digitalWrite(D2, isOn);
digitalWrite(D3, isOn);
digitalWrite(D4, isOn);
}, interval);
}
It’s not very good, but we aren’t super advanced yet.