Other Arduino Codes and Videos by Robojax

Control AC bulb with Arduino AC Swtich with 2 Push buttons

دروس آردوینو به فارسی

Control AC load with Arduino and AC Swtich Module with 2 Push buttons

This this video shows how turn ON or OFF an AC load with Arduino using RobotDyn AC Swtich Module and single push button. Push ON and Push OFF.

Resources for this sketch

 *  RobotDyn AC Switch
 *  Turn AC Load ON or OFF with Triac BTA16 600B module and Arduino
 *  the AC load is turned ON using push button switch and turned OFF using another push button switch
 *  Written by Ahmad Shamshiri on Friday Oct 27, 2019 at 18:50 in Ajax, Ontario, Canada
 * Watch video instruction for this code : https://youtu.be/stCqftdAjI4
 * Get this code and other Arduino codes from Robojax.com
Learn Arduino step by step in structured course with all material, wiring diagram and library
all in once place. Purchase My course on Udemy.com http://robojax.com/L/?id=62

If you found this tutorial helpful, please support me so I can continue creating 
content like this. You can support me on Patreon http://robojax.com/L/?id=63

or make donation using PayPal http://robojax.com/L/?id=64

 *  * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.* 
 * This code has been download from Robojax.com
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

#define switchTurnON 2 
#define switchTurnOFF 3
#define powerControlPin 5 //

const int loadON = HIGH;
const int loadOFF = LOW;
int loadState = loadOFF;// initial state of load
void setup() {
  pinMode(powerControlPin, OUTPUT);
  pinMode(switchTurnON, INPUT_PULLUP);//push button to turn AC load ON
  pinMode(switchTurnOFF, INPUT_PULLUP);//push button to turn AC load OFF
  Serial.println("Robojax AC Switch Demo");

void loop() 
  if( digitalRead(switchTurnON) == LOW)
    loadState = loadON;
    Serial.println("load ON");

  if( digitalRead(switchTurnOFF) == LOW)
    loadState = loadOFF;
    Serial.println("load OFF");    

}// loop end


If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal