Work With Arduino, Controlling Led (First Experiment)

To begin experiment with arduino, we will practice turn on led and controll it. Led is one of semiconductor has Anode and Catode. In this case, the anode led connect to pin 12 and catode connect to GND. Look like easy to implement the design, but if still understand, please look figure below :

Wrtite Sketch
If you learning about programming will familiar with scripts. In arduino system, the scripts is a code and writen at application (Arduino IDE) which called a Sketch. Without Sketch Aruduino can not work or controlling a system.
To run the Arduino IDE follow the instruction below :

  • Klik ikon Arduino 





  • Then will show figure :



















Type the following code :




const int PIN_12 = 12;

voide setup ()

{

pinMode (PIN_12, OUTPUT);

}

void loop ()

{

digitalWrite(PIN_12, HIGH);

delay (1000); //delay 1 second

digitalWrite(PIN_12, LOW);

delay (1000); //delay 1 second

}
The result show figure :



To save our project :
  • click File Menu
  • Click Save As...This step show dialog with tittle "Save Sketch folder as..."

How Verification Sketch
 Before download sketch to arduino, we must verify the sketch to know programming is corect. Sketch which written at Arduino IDE is understanding by human, but not for Arduino. In order to Arduino understand what We write, it need to be verify. To Verification we only click verify. In this process if any mistaken about sketch will be show.
The result of verification sketch is Binary File that will be download to Arduino.



Upload Binary Sketch
If in verification process not error, then we will download the sketch to Arduino. To downloading only click Upload. If success will show "Done Uploading "
After binary sketch upload, Code will execute by Arduino. And the result led will blink.
Congrotulation, it succes !!!
Than we well Undestanding about codes at sketch.

Postingan terkait:

Belum ada tanggapan untuk "Work With Arduino, Controlling Led (First Experiment)"

Post a Comment