An AI-generated image representing the Tree of Knowledge rooted in a breadboard bearing LED fruit.
Arduino icon.

OK, unlike the other “Hello World!” tutorials on stylus, this one will not display “Hello World!” on a screen. We will use one of the included Sketches to get the orange LED on the board to blink. I am also not using an actual Arduino-branded microcontroller; I have a MEGA 2560 R3 Improved Version CH340 from Kuongshun [1], which is an Arduino-compatible board that is part of my Ultimate Mega 2560 R3 Starter Kit from robotico.

An IDE is an Integrated Development Environment. You may already have experience of other IDE’s such as VSCode.

Arduino IDE

I installed and am currently using the latest version of the traditional Arduino IDE.

Install Arduino IDE

Download and install the Windows MSI installer from the official downloads page: https://www.arduino.cc/en/software

The latest version as of 21 February 2025 is Arduino IDE 2.3.4

Arduino Cloud Platform

I am using the installed version of the IDE.

There is also a version you can use in your browser via the Arduino Cloud Platform: the Arduino Cloud Platform IDE allows you to code in your browser.

The Arduino Cloud Agent must be installed and running on your computer in order to connect your board. https://cloud.arduino.cc/

Connect

  1. Connect your board to the power adapter and plug into a power socket.
  2. Connect your board to your computer using the USB cable.
Kuongshung MEGA 2560 microcontroller.Kuongshung MEGA 2560 microcontroller.
  1. Power socket
  2. USB port
  3. Reset button
  4. Orange “L” LED
  5. Green, “ON” power LED

Once the board is connected to your computer via the USB cable and is connected to a power source, both LEDs will be on.

On old computers, communication (COM) ports referred to serial port interfaces on PC-compatible computers. It is now used to refer to emulated ports, such as ports created by Bluetooth or USB adapters.

Configure

I am using the installed version of the IDE.

  1. Select the model of your microcontroller
  2. Select the COM port
An annotated screenshot of the Arduino IDE.An annotated screenshot of the Arduino IDE when compiling and upload a sketch.
  1. The Menu bar
  2. Open the IDE; the sketch details and IDE version appear in the Title bar
  3. The currently selected microcontroller
  4. The name of the sketch file appears in the tab
  5. Your profile if you sign in to Arduino Cloud (it is not necessary to be signed in)
  6. The status bar displayed the details of the currently selected microcontroller
  7. Notifications indicator
  8. Open the bottom panel (if it is closed)
  9. Verify
  10. Upload
  11. Output panel
  12. Prevent scrolling in output panel
  13. Clear output panel
  14. Progress notification

The board’s connection to Windows will be recognised in the Device Manager as follows:

Screenshot of the Windows Device Manager displaying the Arduino board connected correctly on a COM port.
Screenshot of the Windows Device Manager displaying the Arduino board connected correctly on a COM port.
  1. Open the Device Manager
  2. Expand the Ports (COM & LPT) section
  3. Observe the listing for your Arduino-compatible board, which should be on COM5

The sample sketches are read-only, so don’t try and modify them, yet!

At this stage, we want to check that our board is connected and functioning. Fortunately, the IDE includes several sketches. We will use the simplest of them, the Blink sketch. The code in this sketch controls the “L” LED.

When you open the IDE, it automatically creates a new sketch with the date as a default name shown in the tab. If you select File » Close, the whole IDE closes (bug?). So don’t try to close the sketch; navigate as follows to open the Blink sketch: File » Examples » Built-in examples » 01.Basics » Blink

The code below is documented in the comments:

/*
  Blink

  Turns an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino
  model, check the Technical Specs of your board at:
  https://www.arduino.cc/en/Main/Products

  modified 8 May 2014
  by Scott Fitzgerald
  modified 2 Sep 2016
  by Arturo Guadalupi
  modified 8 Sep 2016
  by Colby Newman

  This example code is in the public domain.

  https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
*/
// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(1000);                      // wait for a second
  digitalWrite(LED_BUILTIN, LOW);   // turn the LED off by making the voltage LOW
  delay(1000);                      // wait for a second
}

Notes:

  • Multi-line comments between /* and */
  • Single line comments after //
  • Every sketch has a
    • setup() function, which runs once when the sketch is run
    • loop() function, which runs repeatedly after the setup() has run

Load the sketch to the controller. The code will run as soon as it has finished uploading. The “L” LED will blink.

What language is that?

The language we will use in the Arduino IDE is based on C++. It is not an ideal language for learning programming. If you are more interested in the electronics aspect of Coding & Robotics/automation/IoT/microcomputers, then it is basic enough for you to follow without too much trouble. If you are more interested in the programming side of Coding & Robotics/automation/IoT/microcomputers, then it is worth having a background in some kind of programming, even if it is as basic as Scratch.

Upload

When you hit the Upload button, the code is compiled and loaded into memory on the board. Any errors will be displayed in the Output panel.

Upon success, a message similar to the following will be displayed in the Output panel:

The code will run as soon as it has finished uploading. The “L” LED will blink in the pattern 1 second on, then 1 second off, repeatedly.

Reset button

Hitting the physical Reset button on the board causes the sketch loaded in the board’s RAM to execute.

Modify

Modify the Blink sketch coming soon…


References:

  1. Kuongshun Electronic (no date) MEGA 2560 R3 Improved Version CH340. Available at: https://www.kuongshun-ks.com/uno/uno-board-shield/mega-2560-r3-improved-version-ch340.html (Accessed: 20 February 2025).

By MisterFoxOnline

Mister Fox AKA @MisterFoxOnline is an ICT, IT and CAT Teacher who has just finished training as a Young Engineers instructor. He has a passion for technology and loves to find solutions to problems using the skills he has learned in the course of his IT career.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.