The Hall effect sensor is an analog sensor that allows us to read the strength and polarity of the a magnetic field. This sketch uses the serial monitor to output sensor data.
/* Diyode CodeShield Hall sensor
the hall sensor is sensitive to maagnetic fields and polarity
run this sketch and watch the serial monitor.
bring a magnet close to the sensor and watch the change on serial
monitor.
turn the magnet so the other pole is facing the sensor
observe the change in the serial monitor
*/
#define ENCODER_A 14
#define ENCODER_B 15
#define ENCODER_PORT PINC
#define SWITCH 13
#define BUTTON 12
#define RGB_RED 11
#define RGB_GREEN 10
#define RGB_BLUE 9
#define LED 6
#define SERVO 5
#define PIEZO 3
#define RELAY 2
#define POT 2
#define HALL 3
#define THERMISTOR 4
#define PHOTOCELL 5
void setup() {
Serial.begin(9600);
}
void loop() {
int value= analogRead(HALL);
Serial.print(" The Hall sensor value is ");
Serial.println (value);
delay (10);
}