Arduino code and video Hall Sensor Module
Hall Sensor module for Arduino
Hall sensor switch will detect the magnetic field and module is used to trigger something.
/*
* This is the Arduino code for Hall Sensor module for Arduino
// Written for Robojax.com video
* Hall sensor switch will detect the magnetic field and module is used to trigger something.
* watch video for details https://youtu.be/QH1Lw9BwTJI
* Code is available at http://robojax.com/learn/arduino
*
Written by Ahmad Nejrabi for Robojax.com
on Jan 28, 2018 at 19:41 in Ajax, Ontario, Canada
* Permission granted to share this code given that this
* note is kept with the code.
* Disclaimer: this code is "AS IS" and for educational purpose only.
*
*/
/*
*/
// Hall Sensor code for Robojax.com
#define DETECT 2 // pin 2 for sensor
#define ACTION 8 // pin 8 for action to do someting
void setup() {
Serial.begin(9600);
Serial.println("Robojax.com Hall Module Test");
pinMode(DETECT, INPUT);//define detect input pin
pinMode(ACTION, OUTPUT);//define ACTION output pin
// Flame sensor code for Robojax.com
}
void loop() {
// Hall Sensor code for Robojax.com
int detected = digitalRead(DETECT);// read Hall sensor
int detectedAn = analogRead(A0);// read flame analog value
if( detected == LOW)
{
digitalWrite(ACTION,HIGH);// set the buzzer ON
Serial.println("Detected!");
// Serial.println(detectedAn);// print analog value
}else{
digitalWrite(ACTION,LOW); // Set the buzzer OFF
Serial.println("Nothing");
// Hall Sensor code for Robojax.com
}
delay(200);
}
TTP223 Capacitive Touch Arduino with Relay Code with 5 seconds delay
This video shows you how to use TTP223 Capacitive Touch with relay and AC bulb and the code. the light will turn on and stays on for 5 seconds delay.
/*
* This is the Arduino code for TTP223 Capacitive Touch switch with relay to turn AC or DC load with delay
// December 13, 2017
// Written for Robojax.com video
// Using TTP223 Touch module to turn AC (or DC) load ON and waits for 5 seconds before it goes OFF
// When the touch pad is touched the ligh on the relay will on and the COM and PO pin will be connected
* watch video for details https://youtu.be/YSI1PdSLbt0
*
*
* Written by Ahmad Nejrabi for Roboja Video
* Date: Dec 04, 2017, in Ajax, Ontario, Canada
* Permission granted to share this code given that this
* note is kept with the code.
* Disclaimer: this code is "AS IS" and for educational purpose only.
*
*/
// December 12, 2017
// Written for Robojax.com video
// Using TTP223 Touch module to turn AC (or DC) load ON or OFF.
// When the touch pad is touched the ligh on the relay will on and the COM and PO pin will be connected
int touchPin = 2;// connect output from TTP223 to this
int val = 0;
int relayPin = 10;// Connected to relay
int wait = 5;// wait for 5 seconds
void setup() {
Serial.begin(9600);
pinMode(touchPin, INPUT);
pinMode(relayPin, OUTPUT);
}
void loop() {
digitalWrite(relayPin, HIGH);
val = digitalRead(touchPin);
if(val ==1){
Serial.println("Touched");
digitalWrite(relayPin, LOW);
delay(wait*1000);
}
delay(100);
Serial.println();
}