Page 27 - S.Shafna (1B), 2207, Ass-1
P. 27

❖ Arduino codes



               int tilt = 2;         // the number of the input pin
               int led = 13;       // the number of the output pin

               void setup()
               {
                 pinMode(tilt, INPUT);
                 pinMode(led, OUTPUT);
               }

               void loop()
               {
                 int reading;
                 reading = digitalRead(tilt);

                 if(reading)
                   digitalWrite(led, LOW);
                 else
                   digitalWrite(led, HIGH);
               }

                ❖ Output
   22   23   24   25   26   27   28   29   30   31   32