Pessoal!

 

Estou usando o código abaixo e um imã para ligar e desligar um led.

/*
 Hall Effect Switch

 Turns on and off a light emitting diode(LED) connected to digital
 pin 13, when Hall Effect Sensor attached to pin 2 is triggered by a magnet

 Hall effect sensor used is the A1120EUA from Allegro Microsystems

 This example code is in the public domain.

 http://www.hobbytronics.co.uk/arduino-tutorial8-hall-effect
*/

// constants won't change. They're used here to set pin numbers:
const int hallPin = 12;     // the number of the hall effect sensor pin
const int ledPin =  13;     // the number of the LED pin
// variables will change:
int hallState = 0;          // variable for reading the hall sensor status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the hall effect sensor pin as an input:
  pinMode(hallPin, INPUT);
}

void loop(){
  // read the state of the hall effect sensor:
  hallState = digitalRead(hallPin);

  if (hallState == LOW) {
    // turn LED on:
    digitalWrite(ledPin, LOW);
  }
  else {
    // turn LED off:
    digitalWrite(ledPin, HIGH);
  }
}

Agora quero gerar um campo magnético sem o imã para tentar ligar/desligar o mesmo led. A ideia é fazer o sensor de efeito hall reagir diante de um campo magnético gerado por um fio elétrico de 220v quando eu ligar/desligar a tensão.

Depois meu objetivo será abrir/fechar um relé usando a tensão de um fio 220v, a partir da leitura de um sensor de efeito hall.

Alguém me ajuda?

Agradeço antecipadamente.

Abraços

Antonio Henrique

Exibições: 880

Responder esta

Respostas a este tópico

Antonio estava verificando sua ideia: ( "Depois meu objetivo será abrir/fechar um relé usando a tensão de um fio 220v, a partir da leitura de um sensor de efeito hall"), você conseguiu?

RSS

© 2024   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço