Lighting up Onboard LED Light | MindPlus Coding Kit for Arduino Started Tutorial E01

0 7374 Easy
projectImage

Introduction to Arduino

Chapter 1 Hello world

Lights illuminate our lives. Be it a candle, kerosene, incandescent, or energy-saving bulbs, lamps are a standard for every home, and our most common household appliances. Nowadays, there are a lot of methods on the market to control the on/off of a lamp, including switches, voice control, or other methods. How can we realize that with Arduino?

In this lesson, let's learn how to use Arduino to light up LED lights.

Project 1 Lighting up Onboard LED Light

First let’s write one of the simplest codes to light up the onboard LED lights, which are the LED small lights labeled L on the UNO board (pin13). This step can help us learn how to download the program and test if our Arduino main-board works properly.

Our first task is to make this LED light blink.

projectImage

Task Navigation

1. Experience the programming steps of Mind+

2. Learn sequential structure and loop structure

Key Points Analysis

1. What is a sequential structure?

Designing a program of sequential structure is very easy. You only need to write the corresponding statements by the order of solution to the problem. It executes from top to bottom and executes sequentially. It will not execute B before A.

projectImage

2. What is a loop structure?

A loop structure is designed for programs that need to repeatedly execute a certain function. There are three modules related to the loop structure in Mind+. They are infinite loop, finite loops, and until loop.

projectImage
projectImage

Hands-On

1. Mind+ Introduction

Mind+ is a graphical Programming platform that can support all kinds of open source hardware such as Arduino,micro: bit. It is not only suitable for primary and secondary school students, but also able to provide a great learning environment for makers who want to improve themselves by studying high-level Programming language such as Arduino, python, c, c++ etc. Drag and combine code blocks to make programs, easy to find the joy of creating. From beginners to experienced makers, Mind+ can satisfy all your needs: learning Programming, running programs without downloading, experiencing IoT(Internet of Things), sharing ideas with Mind+ community and so on. Come and play with Mind+, more surprises waiting for you!

2. Setup

1) Go to the Mind+ official website http://mindplus.cc/download-en.html, click download, and install. With a successful installation, we can see a Mind+ icon on the desktop.

projectImage

2) Double-click the icon on the desktop (as shown below) to open Mind+ software and switch the mode to "Offline Mode".

projectImage

To convenient the operation, first we should be familiar with the basic functions of the soft-ware’s interface. If we compare the Mind+ software as a stage, what are the functions of its different sections?

projectImage
projectImage

3) Connect device COMxx

Connect the Arduino main control board to computer’s USB port through the USB cable.

projectImage

* If the port does not appear, please click “Install Serialport Driver”.

4) Select the main control board - Arduino Uno

projectImage

3. Write the program

projectImage
projectImage

4. Program bulb to blink

The blink effect is achieved by setting the LED to on and off, so you need to make it lighten for some period of time and off as well too.

projectImage

5. Upload program

Upon completing the program, click “Upload to device” as shown below to upload the program

to the Arduino mainboard.

projectImage

6. Reference program

projectImage

7. Program effect

The onboard LED light L flickers every 1 second.

8. Program analysis

Arduino mainboard controls elements in digital output or analog output.

Here we are dealing with digital output first. It sends a digital signal to the output circuit, as it switches the circuit on and off by sending 0 or 1.

Its circuit state is as follows:

projectImage

In the reference program, the digital output of pin 13 is set to High level, as a result, the onboard LED(L) bulb connected to it is turned on. The program goes through 1 second delay then (during the delay, the hardware will maintain the state before the delay); at the end of the delay, set the digital output to low to turn off the LED and keep it off for 1 second.

Afterwards, we can see that the on-board LED light is turned on again after being off for 1 second, and then off again after 1 second, and repeats the pattern as it stays on for 1 second and off for 1 second. This is because the program is executed in an infinite loop from top to bottom.

projectImage
icon Program 1-1.rar 165KB Download(10)
License
All Rights
Reserved
licensBg
0