Header Ads Widget

Tilt sensor with Arduino

 Tilt sensor with Arduino




Video-:





Materials Needed-:

  • Arduino board
  • Any color LED bulb
  • TILT sensor
  • Bread Board
  • Buzzer 
  • Jumper wires(male to male and male to female)

Circuit Diagram-:



Code-:

#define TILT 2
#define LED 4
#define BUZZER 3

void setup() {
  Serial.begin(9600);
  pinMode(TILT, INPUT);
  pinMode(LED, OUTPUT);
  pinMode(BUZZER, OUTPUT);
}
void loop() {
  int TILT_VALUE = digitalRead(TILT);
  if (TILT_VALUE == LOW){
    digitalWrite(LED,HIGH);
    digitalWrite(BUZZER, HIGH);
   
  }
  else {
    digitalWrite(LED,LOW);
    digitalWrite(BUZZER, LOW);
  }
}

Download Code and Circuit diagram-: https://drive.google.com/drive/folders/1z3br97RLnsT8Lcogu_vscd4DnHUdhDuz?usp=sharing



Post a Comment

0 Comments