This code is the simplest code to toggle an LED using a switch using Arduino UNO or Arduino Nano. Be careful about the connections of resistor, switch and LED together. Just use the following code, burn it in your Arduino and run the project. Its that simple…! The following code line is the actual outcome […]
Arduino
Direct Port Register Addressing in Arduino
This method is also called as Direct Port Register Addressing Technique. In this technique we use the programming methodology of AVR microcontroller programming. So to understand this method, we shall see the basics of AVR programming first. Remember that C & C++ commands are used in AVR. The pinout of ATMega328p is given below. Unlike […]
Trick of using userDefined_Function() in Arduino
Such types of functions are called as User Defined Functions (UDFs). They are NOT the default functions of Arduino. The userDefined_Function() function can be used in the program as follows: The Code int LED0=0; int LED1=1; int LED2=2; int LED3=3; int LED4=4; int LED5=5; int LED6=6; int LED7=7; void allLEDs_ON() { digitalWrite(LED0, HIGH); digitalWrite(LED1, […]
Basic Servo Control
Connect the orange wire of servo to pin-0. If your Servo Motor doesn’t work properly. Connect its orange wire at pin number: 3, 5, 6, 9, 10 or 11 of Arduino Board and then change the code line as i.attach(0) or i.attach(5) and so on… The Connection Diagram The Code /* * Basic Servo Motor […]
Blicking 8 LEDs
To write program for blinking 8 LEDs for above given circuit, you have to define 8 variables first. Then you have to write 8 pinMode statements. Then you have to write 8+8=16 digitalWrite commands to make the LEDs on/off. This is sooooooo boring…! Connection Details The Code int LED0=0; int LED1=1; int LED2=2; int LED3=3; […]