Created as a showcase project, AMAZE-28, the single-room summer house, was successfully constructed within 28 days on the grounds of the Kerala State Nirmithi Kendra. The 3D-printed building at the Kerala State Nirmithi Kendra in Thiruvananthapuram. (Photo: Shekunj) The inauguration of Kerala's inaugural 3D-printed structure, a 380-square-foot single-room summer house, is scheduled to take place on October 10 at the Kerala State Nirmithi Kendra (Kesnik) campus located in PTP Nagar, Thiruvananthapuram. Conceived as a showcase initiative, the summer house named AMAZE-28 was successfully finished within a mere 28 days. This impressive project was executed by Tvasta, a construction technology startup based in Chennai, founded by alumni of IIT-Madras, who have entered into a memorandum of understanding (MoU) with Kesnik. AMAZE-28 is perched upon a concrete foundation atop a gentle elevation within the Kesnik campus. Febi Varghese, the Director and Chief Executive Officer of...
his is the very first step to learn Arduino, or you can say that blinking LED with Arduino is the "Hello World!" of Arduino learning. So, in this tutorial, we will start with interfacing and controlling a LED with Arduino. To perform this activity we will need some components which are mentioned below.
Components Needed
- Arduino Board
- Bread Board
- Jumper wires
- Resistor (220 ohm or more)
- Arduino IDE
So, After collecting all these components, let us make circuit as per the diagram given below.
LED Interface with Arduino |
After circuit diagram, next step program the controller, for this we have to open the Arduino IDE and start a new sketch. New window of IDE will look like the image given below.
Arduino IDE Sketch |
There are two loops:
- void setup(): This loop run only once at the starting of Arduino. This loop contains fix parameter for our code. We can say this loop is used to set up all the hardware connected to Arduino and prepare them to working. This is used to prepare Arduino for communicating with all the hardware connected with it. Example: Defining Input and Output pin on Arduino, starting Serial monitor, setting up the LCD display, etc.
- void loop(): This the loop runs again and again while the Arduino is in POWER ON mode. So, obviously, in this loop, we have to write the main code to perform our activity.
void setup() { // initialize digital pin 5 as an output. pinMode(5, OUTPUT); }
To define the input or output pin, in setup loop, pinMode(), function is used. This is a case sensitive and inbuilt function. Syntax of this function is given below:
pinMode(pin_of_arduino, INPUT/OUTPUT);
Again, INPUT and OUTPUT are the case sensitive inbuilt function to assign the pin as input pin or output pin.
Now, we have assigned, say pin 5, as output pin (as in code above). Our next aim is to blink it at regular time interval. So, this activity will be performed inside loop().
void loop() { digitalWrite(5, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(5, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
As you can see in this code two more inbuilt functions are being use - digitalWrite() and delay(). Syntax for these function is given below:
digitalWrite(output_pin, LOW/HIGH) ;
delay(time_in_milliseconds);
digitalWrite() is used to instruct the micro-controller to set output pin at high or low logic level, for this HIGH or LOW commands will be used respectively.
Similarly, delay() function provides a halt of time given to it as parameter (in microseconds).
NOTE:
- // is used to comment in code. Anything we write after // in a line, it is treated as comment by compiler, it does not include in real code.
- One can also use 1 at place of HIGH and 0 ('zero') at the place of LOW.
Complete Arduino code for this activity is given below:
void setup() { // initialize digital pin 5 as an output. pinMode(5, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(5, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(5, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
You can also visit the video tutorial for this activity, which is given below.
Thanks for visiting! We will meet in next tutorial.
Comments
Post a Comment