/* Hall Effect sensor as Switch www.theorycircuit.com */
/* Caricato su esp8266 d1= gpio163 d8=gpio13*/
/*Usato Neodimio*/
const int hallPin = 16; // hall effect sensor out pin
const int ledPin = 13
; // LED pin
int hallState = 0; // Initial hall sensor status
void setup() {
pinMode(ledPin, OUTPUT); // LED pin as an output
/
pinMode(hallPin, INPUT); // The hall effect sensor pin as an input
}
void loop(){
hallState = digitalRead(hallPin); // reading the state of the hall effect sensor pin
if (hallState == HIGH) {
digitalWrite(ledPin, LOW); // turn LED on
}
else {
digitalWrite(ledPin, HIGH); // turn LED off
}
}