搜索代码

Control an AC bulb with an Arduino AC switch

Control an AC bulb with an Arduino AC switch

This video shows how to turn on or off an AC load with an Arduino using a RobotDyn AC Switch Module.


Resources for this sketch

257-Resources for this sketch
语言: C++
/**************
 *  RobotDyn AC Switch
 *  
 *  Turn AC Load ON or OFF with Triac BTA16 600B module and Arduino
 *  
 *  Written by Ahmad Shamshiri on Friday, October 27, 2019 at 18:50 in Ajax, Ontario, Canada
 *  
 * Watch video instructions for this code:
 * https://youtu.be/1phdcshRZ_I
 * 
 * 
 * Get this code and other Arduino codes from Robojax.com
Learn Arduino step by step in a structured course with all material, wiring diagrams, and libraries
all in one place. 

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

or make a 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 downloaded 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
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    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 powerControlPin 5 //



void setup() {
  Serial.begin(9600);
  pinMode(powerControlPin, OUTPUT);
}

void loop() 
{
   digitalWrite(powerControlPin,HIGH);
   delay(3000);// keep the light (or another AC Load) ON for 3 seconds
   digitalWrite(powerControlPin,LOW);
   delay(2000);// keep the light (or another AC Load) OFF for 2 seconds
}

资源与参考

尚无可用资源。

文件📁

没有可用的文件。