• 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 435 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Orthopaedic 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

You can subscribe to our Free Once a Day, Regular Newsletter by clicking the subscribe button below.

Click To Subscribe

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 (20K Followers)
  • Twitter (4.9k Followers)
  • Facebook (5.8k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.2k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • How To Repack Installed Software on Debian/Ubuntu January 16, 2021
  • Components of Agile Software Development January 15, 2021
  • What is Conway’s Law? January 14, 2021
  • Effects of Digitization on Companies : Part XIII January 13, 2021
  • What is SoftAP Mode? January 12, 2021

 

About This Article

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

Source:The Customize Windows, JiMA.in

 

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Cookie Policy.

PC users can consult Corrine Chorney for Security.

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

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

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