ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Tutorial 12: For Loop Iteration: Arduino Course for Absolute Beginners (ReM)

Автор: Programming Electronics Academy

Загружено: 2013-10-17

Просмотров: 171946

Описание: 🤩 Get the 10 Arduino Programming Tips PDF here 👇👇
https://bit.ly/42RKnRE

**If you like this, I think you'll like the premium Arduino training we offer. Check it out here** https://bit.ly/3nSBPUs

We designed this circuit board for beginners!
Kit-On-A-Shield: https://amzn.to/3lfWClU

SHOP OUR FAVORITE STUFF! (affiliate links)
---------------------------------------------------

We use Rev Captions for our subtitles
https://bit.ly/39trLeB


Arduino UNO R3:
Amazon: https://amzn.to/37eP4ra
Newegg: https://bit.ly/3fahas8

Budget Arduino Kits:
Amazon:https://amzn.to/3C0VqsH
Newegg:https://bit.ly/3j4tISX

Multimeter Options:
Amazon: https://amzn.to/3rRo3E0
Newegg: https://bit.ly/3rJoekA

Helping Hands:
Amazon: https://amzn.to/3C8IYXZ
Newegg: https://bit.ly/3fb03X1

Soldering Stations:
Amazon: https://amzn.to/2VawmP4
Newegg: https://bit.ly/3BZ6oio

AFFILIATES & REFERRALS
---------------------------------------------------
►Audible Plus Free trial: https://amzn.to/3j5IGrV

►Join Honey- Save Money https://bit.ly/3xmj7rH
►Download Glasswire for Free:https://bit.ly/3iv1fql

FOLLOW US ELSEWHERE
---------------------------------------------------
Facebook:   / programmingelectronicsacademy  
Twitter:   / progelecacademy  
Website: https://www.programmingelectronics.com/

Click Below to Read About This Topic on Our Website
https://programmingelectronics.com/tu...

Description:
Arduino Course for Absolute Beginners

There are few functions so useful that you find them everywhere. The 'for loop' is an example of this type. A For Loop repeats an action for a specified number of iterations, reducing the lines of code that need to be written thus making the programmers life easier.

In this example we are setting out to make a row of LEDs light up somewhat similar to Kit in Knight Rider.

You Will Need

LED (6)
220 Ohm Resistor (6)
Solder-less Breadboard
Jumper Wires (1)
Red Canary (42)
Step-by-Step Instructions

Connect one side of a resistor into pin 2, connect the other side into a row on the breadboard.
From that row in the breadboard where you attached the resistor, connect the long leg of the LED.
Connect the short leg of the LED to one of the power strip columns on your breadboard.
Now connect a resistor to pin 3, and put the other leg in a row on the breadboard (a different one then your first LED.
Connect an LED in the same manor - make sure the short leg goes in the SAME power strip column as the previous LED.
Repeat this through pin 7.
Using a jumper wire, connect the common power strip to a GND pin on the Arduino.
Connect the Arduino to your computer.
Open up the Arduino IED.
Go to File, Examples, 05.Control, ForLoopIteration
Click the Verify button (Top Left). The button will turn orange and then blue once finished.
Click the Upload button. The button will turn orange and then blue when finished.
Watch in awe as your LEDs turn on and off in sequence.

The first executable code we find is the declaration of the 'timer' variable...

int timer = 100; // The higher the number, the slower the timing.

This integer variable with a descriptive name will set the rate between one LED turning on and off. What is so important about variables like these is how easy they allow you to alter your code and how your circuit will run. If the programmer had written the number 100 in a bunch of functions through out this program we would have had the exact same effect, but as soon as we want to speed up the blinking of the LEDs, now we have to go through and change every 100 to a 500 - what a pain - especially when you miss a couple 100's, and accidentally put a 500 where there shouldn't have bee one. These variables are like controls into your program - imagine you are on the Star Ship Enterprise, all those buttons and touch screen levers - these are your control variables.

Our next friendly block of code is setup(). In this setup() function we run into our first For Loop.

void setup() {

for (int thisPin = 2; thisPin LT 8; thisPin++) {

pinMode(thisPin, OUTPUT);

}

}

Let's consider just what is inside the parenthesis following the for loop..

for (int thisPin = 2; thisPin lt 8; thisPin++)

There are three separate statements in the parenthesis separated by a semicolon. The first statement is initialization of the counter variable used in the 'for loop' and it looks like any other variable declaration and initialization that you have seen.

int thisPin = 2;

The 'thisPin' variable is what will be used in the next block of code - or the test.

thisPin lt 8;

This is the test condition that will tell the loop to keep going or to stop. If this condition is TRUE, the code in the curly brackets of the 'for loop; will be executed again, if the condition is FALSE, the

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Tutorial 12: For Loop Iteration: Arduino Course for Absolute Beginners (ReM)

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

Скетч Arduino с millis() вместо delay()

Скетч Arduino с millis() вместо delay()

Урок 10: Плавное изменение яркости светодиода: курс Arduino для начинающих (ReM)

Урок 10: Плавное изменение яркости светодиода: курс Arduino для начинающих (ReM)

Tutorial 07: digitalRead() and the Serial Port: Arduino Course for Absolute Beginners (ReM)

Tutorial 07: digitalRead() and the Serial Port: Arduino Course for Absolute Beginners (ReM)

TRIPLE the WiFI RANGE of your ESP32 C3 using ONE wire! #esp32

TRIPLE the WiFI RANGE of your ESP32 C3 using ONE wire! #esp32

Hack Pack – Введение в Arduino

Hack Pack – Введение в Arduino

Arduino Course for Absolute Beginners (Re-mastered)

Arduino Course for Absolute Beginners (Re-mastered)

Как я с нуля сделал ноутбук на базе C64 — Portable 64 (эмуляция)

Как я с нуля сделал ноутбук на базе C64 — Portable 64 (эмуляция)

Creating the World's Most Efficient Drone

Creating the World's Most Efficient Drone

Stepper Motors with Arduino - Controlling Bipolar & Unipolar stepper motors

Stepper Motors with Arduino - Controlling Bipolar & Unipolar stepper motors

Миллис против задержки. Часть 3 | Мини-сериал о синхронизации событий с помощью кода Arduino

Миллис против задержки. Часть 3 | Мини-сериал о синхронизации событий с помощью кода Arduino

Understanding HIGH and LOW Arduino Pin States :: Open Source Hardware Group Arduino Tutorials

Understanding HIGH and LOW Arduino Pin States :: Open Source Hardware Group Arduino Tutorials

Как работают ДАТЧИКИ ХОЛЛА? Самое понятное объяснение!

Как работают ДАТЧИКИ ХОЛЛА? Самое понятное объяснение!

Делаю эволюцию ИИ в Unity

Делаю эволюцию ИИ в Unity

“Hello, world” from scratch on a 6502 — Part 1

“Hello, world” from scratch on a 6502 — Part 1

ТАКОЕ НЕ ПОКАЖУТ В ВУЗах-  Как работают и для чего нужны транзисторы ? Что такое PN переход?

ТАКОЕ НЕ ПОКАЖУТ В ВУЗах- Как работают и для чего нужны транзисторы ? Что такое PN переход?

Первый взгляд на Arduino Uno Q: настройка, функции и новинки.

Первый взгляд на Arduino Uno Q: настройка, функции и новинки.

Как производятся микрочипы? 🖥️🛠️ Этапы производства процессоров

Как производятся микрочипы? 🖥️🛠️ Этапы производства процессоров

Функция Arduino millis(): 5+ вещей, которые следует учесть

Функция Arduino millis(): 5+ вещей, которые следует учесть

От 0 до создания руки робота с помощью Arduino

От 0 до создания руки робота с помощью Arduino

Где начало СХЕМЫ? Понимаем, читаем, изучаем схемы. Понятное объяснение!

Где начало СХЕМЫ? Понимаем, читаем, изучаем схемы. Понятное объяснение!

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]