• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » How to Learn Arduino Programming

By Abhishek Ghosh May 27, 2018 8:44 am Updated on June 2, 2018

How to Learn Arduino Programming

Advertisement

We previously discussed that Arduino has no Programming Language of it’s own. Arduino Basically For the Advanced Hobbyists. It Does Not Take Much Time to Learn Basic C, C++. But Again, How to Learn Arduino Programming So That Others’ Projects Can Be Improved OR Own Idea Can Be Realized? Arduino is an open-source prototyping platform for the makers, artists, designers, hobbyists, or anyone interested in creative things. Depending on the person’s need, amount of learning should be directed. We are explaining basics and providing some resources.

 

How to Learn Arduino Programming?

 

The language Arduino uses is like C++, but it is very different from common C++ as Arduino uses abstraction to make it simple to use. A background of Java, C and C++ will make advanced uses easy. Arduino IDE uses GCC compiler and avoid makefile, obviously it supports C++. The directories named like “core”, the libraries are C++.

Knowing about C++ programming includes learning basic loops, declarations,functions, classes and so on. C++ takes about 2 weeks to get used, know about setup, loop, basic commands specific or non-specific for Arduino like pinout, pinin, analogout, digitalread, digitawrite, analogread, analogwrite and so on.

Advertisement

---

Every snippet or code of Arduino is called sketch. Each sketch has two void functions – setup() and loop(). Commonly void type function itself returns no value.

setup() is a method. setup() is ran once after the Arduino is powered up or reset made. The loop() method continuously run. So we learned :

Vim
1
2
void setup() { }
void loop() { }

The above will not return any value if uploaded on Arduino board. If or hardware is a LED, then we need to define the ledPin which will call Arduino’s function named pinMode(). Here is reference :

Vim
1
https://www.arduino.cc/reference/en/language/functions/digital-io/pinmode/

pinMode(pin, mode) has 3 modes : INPUT, OUTPUT, INPUT_PULLUP. If we used component like a push button switch instead of LED, we would use INPUT. As LED is an output at pin 13, we will use OUTPUT or INPUT_PULLUP, if we add one push button at pin 4 then :

Vim
1
2
3
4
5
6
7
8
9
int ledPin = 13;
void setup()
{
  pinMode(13, OUTPUT);
  pinMode (4, INPUT_PULLUP);
}
void loop()
{
}

OR

Vim
1
2
3
4
5
6
7
8
9
10
int ledPin = 13;
int buttonPin = 4;
void setup()
{
  pinMode(13, OUTPUT);
  pinMode(4, INPUT);
}
void loop()
{
}

We ended each line with a semicolon. Now what we want to do? To blink, first think of this :

Light on LED
For n seconds
Light off LED
For n seconds

That means :

Vim
1
2
3
4
  digitalWrite(13, HIGH);       // sets the digital pin 13 on
  delay(1000);                  // waits for a second
  digitalWrite(13, LOW);        // sets the digital pin 13 off
  delay(1000);                  // waits for a second

So basic code to link becomes :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
int ledPin = 13;
void setup()
{
  pinMode(13, OUTPUT);
}
void loop()
{
  digitalWrite(13, HIGH);
  delay(1000);  
  digitalWrite(13, LOW);
  delay(1000);
}

If we use a push button turn on LED and let it remain ON still pressed, then :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
int pinButton = 4;
int ledPin = 2;
 
void setup() {
  pinMode(pinButton, INPUT);
  pinMode(ledPin, OUTPUT);
}
 
void loop() {
  int stateButton = digitalRead(pinButton);
  if(stateButton == 1) {
     digitalWrite(LED, HIGH);
  }
}

if(stateButton == 1 means button is pressed.

OR we can write :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const int switchPin = 4;
const int ledPin = 8;
int switchState = 0; // reading switch status
void setup()
{
    pinMode(ledPin, OUTPUT);
    pinMode(switchPin, INPUT_PULLUP);
}
void loop()
{
    switchState = digitalRead(switchPin);
    if (switchState == LOW)
    {
        digitalWrite(ledPin, HIGH);
        delay(3000);
        digitalWrite(ledPin, LOW);
    }
}

Here is diagram of the above :

How to Learn Arduino Programming

if (switchState == LOW) means if the switch is pressed. If you want that the LED remains ON after button is pressed, that you have to learn. Here is reference and a notebook for you for that homework :

Vim
1
2
https://www.arduino.cc/reference/en/
https://playground.arduino.cc/uploads/Main/arduino_notebook_v1-1.pdf

Arduino official site has good number of user created documentation, examples.

This Article Has Been Shared 895 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How to Learn Arduino Programming

  • Methods and Components To Build Electronic Circuits

    We Have Discussed Some Details On Methods and Components To Build Electronic Circuits Which Are Needed To Create Ammeter Electronic Projects.

  • Arduino 7 Segment LED Display Temperature Sensor (TM1637 & DHT11)

    Circuit, Code To Build Temperature Sensor For Air-conditioned Car With Arduino 7 Segment LED Display TM1637 & Cheap DHT11 Temperature Sensor.

  • Arduino Multifunction Shield (HCARDU0085) : Features

    Arduino Multifunction Shield Has 4 Digit 7 Segment LED Display, 4 SMD LED, 10K Potentiometer, 3 Push Buttons, Buzzer And Lot of Interfaces.

  • Which Size of Battery to Choose For Electronics Works : AA, AAA, D, C

    Which Size of Battery to Choose For Electronics Works Among AA, AAA, D, C Sizes? All are of 1.5v but there are matters which need calculation.

  • Mechanical Counter for Arduino : Basic Information

    Here is Basic Information Around Mechanical Counter for Arduino as They are Difficult to Find Outside Industrial Usage. They Can Be Stepper Motor Counter With or Without Reset.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • The Importance of Voice and Style in Essay Writing April 1, 2023
  • What Online Casinos Have No Deposit Bonus in Australia March 30, 2023
  • Four Foolproof Tips To Never Run Out Of Blog Ideas For Your Website March 28, 2023
  • The Interactive Entertainment Serving as a Tech Proving Ground March 28, 2023
  • Is it Good to Run Apache Web server and MySQL Database on Separate Cloud Servers? March 27, 2023

About This Article

Cite this article as: Abhishek Ghosh, "How to Learn Arduino Programming," in The Customize Windows, May 27, 2018, April 1, 2023, https://thecustomizewindows.com/2018/05/how-to-learn-arduino-programming/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT