Using Arduino push button to Push ON and Push OFF relay and AC bulb Robojax.com

Using Arduino push button to Push ON and Push OFF relay and AC bulb

This is the Arduino code for push button to push ON and Push OFF a relay and AC bulb http://robojax.com/learn/arduino/
  1. download TTP223B Capacitive Touch Manual
  2. 
     /*
     * This is the Arduino code for push button to push ON and Push OFF a relay and AC bulb
     * the output pen 10 is connected to relay 
     * watch video instruction on video https://youtu.be/7CCSRs5bvH0
     * Be carefull working with AC is dangrous. Disconnect from AC power when working and wear protective gloves when touch the AC components.
    
     * 
     * Written by Ahmad Nejrabi for Roboja Video, www.Robojax.com
     * Date: Dec 14, 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.
     * http://robojax.com/learn/arduino/
     * 
     */
    
    
    int pbuttonPin = 2;// connect output to push button
    int relayPin = 10;// Connected to relay (LED)
    
    int val = 0; // push value from pin 2
    int lightON = 0;//light status
    int pushed = 0;//push status
    
    
    void setup() {
      Serial.begin(9600);
      pinMode(pbuttonPin, INPUT_PULLUP); 
      pinMode(relayPin, OUTPUT);
    
    }
    
    void loop() {
    
      val = digitalRead(pbuttonPin);// read the push button value
    
      if(val == HIGH && lightON == LOW){
    
        pushed = 1-pushed;
        delay(100);
      }    
    
      lightON = val;
    
          if(pushed == HIGH){
            Serial.println("Light ON");
            digitalWrite(relayPin, LOW); 
           
          }else{
            Serial.println("Light OFF");
            digitalWrite(relayPin, HIGH);
       
          }     
    
    
    
      delay(100);
    }