7. Embedded programming¶
Types of currents: - AC: Alternating Current - is a type of electrical current, in which the direction of the flow of electrons switches back and forth at regular intervals or cycles.
from; Refrigerators, dishwashers, etc.
- DC: Direct current - is electrical current which flows consistently in one direction.
from batteries, cell phones, flashlights, electrical vehicles, etc.
The following figure shows a simple electrical circuit;
NEW TERMS: -V: Voltage (volt) -I: Current (amps) -P: Power (Watt)
Using a software helps to simulate a electrical circuit & others
ARDUINO¶
I have a previous simple knowledge about ARDUINO UNO, so It’s like similar to the ARDUINO Nano
Simple ARDUINO definition: Arduino is a microcontroller-based open source electronic prototyping board which can be programmed with an easy-to-use Arduino IDE. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online.
Components of ARDUINO Nano :
Start point¶
I downloaded ARDUINO IDE
Then I started to setup and identify my Computer on the ARDUINO Nano by connecting them with the USB cable, and then following these steps;
Make sure to choose the processor as ATmega328P by following figure below;
Choose your Arduino type (mine is ARDUINO Nano)
Play time¶
I will try to learn how to blink the light by testing the programming Blink code;
Red arrow = is to upload or start the program on ARDUINO so click it when the code is done.
Blue circles = waiting seconds, change the number to see what happened with the light.
The below link is a Youtube video shows the blink program how it worked with me before & after changing the numbers.
Blink Code¶
// 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
}