Wednesday, July 13, 2016

Filled Under: , , ,

Bare Minimum code needed

Arduino Arduino UNO R3 Basic library

This example contains the bare minimum of code you need for a sketch to compile properly on Arduino Software (IDE): the setup() method and the loop() method.

Step 1: What You Need?

1x Arduino Board (Arduino UNO R3 used in this tutorial)

Step 2: Circuit. 

Step 3: Code. 

1. Select the Arduino board type: Select Tools >> Board >> Select your correct Arduino board used. 

2.  Find the port number by accessing device manager on Windows. See the section Port (COM&LPT) and look for an open port named "Arduino Uno (COMxx)". If you are using a different board, you will find a name accordingly. What matters is the xx in COMxx part. In my case, it's COM3. So my port number is 3. 

Select the right port: Tools >> Port >> Select the port number.



3. You can find this code in the example of Arduino IDE.
Select File >> Examples >> 01.Basics >> BareMinimum



The setup() function is called when a sketch starts. Use it to initialize variables, pin modes, start using libraries, etc. The setup function will only run once, after each powerup or reset of the board.

After creating a setup() function, the loop() function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond as it runs. Code in the loop()section of your sketch is used to actively control the board.

The code above won't actually do anything, but it's structure is useful for copying and pasting to get you started on any sketch of your own. It also shows you how to make comments in your code.



Any line that starts with two slashes (//) will not be read by the compiler, so you can write anything you want after it. The two slashes may be put after functional code to keep comments on the same line. Commenting your code like this can be particularly helpful in explaining, both to yourself and others, how your program functions step by step.

Download: 

Arduino software


Sources:[https://www.arduino.cc/en/Tutorial/BareMinimum]

Unknown

Author & Editor

My Robot Education Sdn. Bhd. (Robotedu.my) was founded in 2015 as the first robotics education centre in Malaysia to provide Arduino-based robotics courses for youths. Our vision is to be able to provide robotics education to every youth in Malaysia.

0 comments:

Post a Comment

 

  • Copyright © Arduino Tutorial ™ is a registered trademark.
    Designed by Templateism. Hosted on Blogger Templates.