Things used in this project

Hardware components:
Relay
Relay Module for Tessel
×1
A000066 iso both
Arduino UNO & Genuino UNO
×1
hall sensor
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
×1
Hand tools and fabrication machines:
hydrolic pump
electric motor
solenoid valve

Schematics

untitled_sketch_bb_IVg5KrAyD7.jpg
Untitled sketch bb ivg5krayd7

Code

magnetic_switch.inoArduino
const int hall1Pin = 7;     // the number of the hall effect sensor pin
const int ledPin1 =  2; // the number of the LED pin
const int hall2Pin = 10;
const int ledPin2 = 4;
int hall1State = 0; 
int hall2State = 0;  // variable for reading the hall sensor status

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

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

  if (hall1State = HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin1,LOW);
     
  } 
  
  else {
    // turn LED off:
    digitalWrite(ledPin1, HIGH);
  } 
    
    
    
   hall2State = digitalRead(hall2Pin);

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

Credits

Iasonopaido
iasonopaido
1 project • 0 followers
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login