Other Arduino Codes and Videos by Robojax
Learn Arduino from scratch. Step by step from proven instructor with years of experience. The course will start on getting and installing Arduino software, then Arduino boards are introduced and practically projects are shown with wiring diagram and how to wire them. All the codes are provided for download. .
Codes for this coruse:
/*
* For loop code: Robojax Crash Course on Arduino: Learn Arduino in 30 Minutes
*
* Watch video instruction :https://youtu.be/Mbb2xa1WcRM
*
* Written Mar 08 2020 at 12:13 in Ajax, Ontario, Canada
*
* 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
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/>.
*/
int relayPin = 2;//defined pin 2 for relay
void setup() {
pinMode(relayPin, OUTPUT);
// initialize serial communications at 9600 bps:
Serial.begin(9600);
Serial.println("Robojax: Relay Control");
delay(3000);
//Robojax Crash Course on Arduino: Learn Arduino in 30 Minutes
}
void loop() {
digitalWrite(relayPin, LOW);//turn the relay ON
Serial.println("Light ON");
delay(300);//keep it ON for 2 seconds
digitalWrite(relayPin, HIGH);//turn it OFF
Serial.println("Light OFF");
delay(500);//keep it OFF for 2 seconds
//Robojax Crash Course on Arduino: Learn Arduino in 30 Minutes
}
If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal