Introduction to Arduino programming







        Programs/Classes details 
Introduction to Arduino programming



In the previous section, you learned about the Arduino IDE, the tool of choice for people new to the Arduino. When it comes to the Arduino and microcontrollers in general, programming is a case skill. It's as important at least as a basic understanding of electronics but fear not. It can achieve a lot by achieving a basic level of competency in programming. In this section, I will introduce you to the Arduino programming basics. You will learn about functions, variables, and control structures. You'll learn how to control the Arduino digital input and output pins. You will use this knowledge to control LEDs and read the state of buttons and the geometers, some of the most commonly used components in Arduino prototyping.
Introduction 


In this lecture we look at an introduction to Arduino programming.
An introduction to Arduino programming 


In this lecture we look at Understanding the basic parts of an Arduino sketch.
Understand the basic parts of an Arduino sketch 


In this lecture we look at getting started with custom functions.
Getting started with custom functions 


In this lecture we look at creating custom functions with parameters.
Creating custom functions and the return keyword 


In this lecture we look at using variables.
Using variables 


In this lecture we look at Understanding the variable scope.
Understanding variable scope 


In this lecture we look at understanding constants.
Understanding constants 


In this lecture we will talk about loops and conditionals. Conditionals are useful when you want to change the flow of execution in your sketch, and loops are useful when you want to repeat a block of code multiple times. Very often, these two work together and that's why I discuss them here together. Let's start with a conditional, and let's have a look at the simplest conditional out there. It's the "if" statement. 
Introduction to control structures: The "if" statement 


In this lecture we will look at the "while" structure. 
"While" is a way to create a loop. 
There is a decision involved, so it's not strictly speaking a controlled structure. It's a looping structure, a repeat structure.
Introduction to control structures: The "while" statement 


Another very common looping structure that is available on the Arduino is the "for" loop. 
The "for" loop is a way to explicitly repeat a block of code a specific number of times that we have predetermined. 
In this lecture I will show you how this works.
Introduction to control structures: The "For" statement 


The next structure that I'd like to show you for this part of the lecture is the "switch" structure. 
The "switch" structure provides an easy way to allow you to jump to a particular part of the structure, depending on the value of the variable. 
This is useful if you have things such as a bunch of buttons and you want your gadget to do something different depending on which button was pressed. 
Introduction to control structures: The "Switch" statement 


Now that you have a good, even though it's just the beginning, understanding of some of the basic concepts in Arduino programming. You can move on and have a look at how to use the digital input and output pins that come with the Arduino. Of course input and output are fundamental features of the market controller can connect devices to special pins on your Arduino and to read or change the state of these pins, through special instructions in your sketch. There are two kinds of input and output pins on the Arduino. They are digital and analog pins.
In this lecture,we'll start with digital pins.
Digital output - how to control an LED 


Getting an LED to blink is quite easy once you understand how to configure a digital pin to become an output control, the delay, and so on fairly simple.
But what about a button? A button requires to configure a digital pin as an input, so that we can use it to detect the button's state. In this lecture, I will show you how to do this.
Digital input - how to read the state of a button 


In this lecture we will continue our work with the Arduino's input/output pins by taking a look at the analog pins. 
Analog signals on microcontrollers is a tricky topic. Most microcontrollers can't generate true analog signals, that means they cannot create and output true analog signals, like an audio signal for example. But they are better at reading analog signals, so they can read for example, the output of a microphone. The atmega328p which is used in the Arduino Uno simulates analog signals using a technique called "pulse width modulation", and I'll talk a little bit about it a bit later when we look at how we can get the LED to, instead of just turning on and off, to get it to fade gradually from an fully off state to a fully on state.
Analog input - how to read the state of a potentiometer 


Reading an analog value is very simple. But what about creating an analog signal? And why would we want to do this? 
In this lecture, I will explain both.
Analog output - how to create a fading LED 


In this lecture, what I'd like to do is to first, show you how to use an RGB LED, a red, green, blue color led to, of course, create red green and blue light coming out of the LED.
Introduction to the RGB (color) LED 


In this lecture I will show you how to wire up your RGB LED.
Wiring the RGB LED 


In this lecture I will show you how to combine the red green and blue color components to create other colors.
RGB LED: creating colors 


In this lecture I will show you how to use a library in order to make RGB color control much easier.
Using a library to control an RGB LED with PWM 

No comments:

Post a Comment