1 Lesson 20: Project What you will need • CloudProfessor (CPF) • Arduino Leonardo • Arduino Shield • USB cable • LED 101 light • RGB LED Light Learning Expectaons (how learning / progress will be demonstrated) All Create a plan for their project using flow diagrams or pseudocode. Most Create a fully working app using either Blockly or JavaScript. Some Use logical reasoning to detect errors in their app. Learning Objecves Produce algorithms in pseudocode or flow diagrams to solve a problem. Design and create an app which uses sequence, selecon, repeon and variables. Program, debug and refine the code for an app. Overview In this lesson, students will use what they have learnt in the previous lessons to design and implement their own Internet of Things (IoT) project. Curriculum Links (Compung PoS) Designs simple algorithms using loops, and selecon i.e. if statements. (AL) Uses logical reasoning to predict outcomes. (AL) Detects and corrects errors i.e. debugging, in algorithms. (AL) Creates programs that implement algorithms to achieve given goals. (AL) Understands that programming bridges the gap between algorithmic soluons and computers. (AB) Computaonal Thinking Concepts: AB = Abstracon; DE = Decomposion; AL = Algorithmic Thinking; EV = Evaluaon; GE = Generalisaon. Lesson 20 Project 1 • White LED • Light sensor • Temperature sensor • Fan motor • Servo / Buzzer / PIR / Buon / LCD backlight
4
Embed
Lesson 20 - Acer for Education€¦ · RG LED Setting colour with: The RGB LED Setting colour with block sets the colour of the attached RG LED. The colour can be either set manually
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1 Lesson 20: Project
What you will need
• CloudProfessor (CPF)
• Arduino Leonardo
• Arduino Shield
• USB cable
• LED 101 light
• RGB LED Light
Learning Expectations (how learning / progress will be demonstrated)
All Create a plan for their project using flow diagrams or pseudocode.
Most Create a fully working app using either Blockly or JavaScript.
Some Use logical reasoning to detect errors in their app.
Learning Objectives
Produce algorithms in pseudocode or flow diagrams to solve a problem.
Design and create an app which uses sequence, selection, repetition and variables.
Program, debug and refine the code for an app.
Overview
In this lesson, students will use what they have learnt in the previous lessons to design and implement their own Internet of
Things (IoT) project.
Curriculum Links (Computing PoS)
Designs simple algorithms using loops, and selection i.e. if statements. (AL)
Uses logical reasoning to predict outcomes. (AL) Detects and corrects errors i.e. debugging, in algorithms. (AL)
Creates programs that implement algorithms to achieve given goals. (AL)
Understands that programming bridges the gap between algorithmic solutions and computers. (AB)
Computational Thinking Concepts: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation;
GE = Generalisation.
Lesson 20 Project
1 • White LED
• Light sensor
• Temperature sensor
• Fan motor
• Servo / Buzzer / PIR /
Button / LCD backlight
2 Lesson 20: Project
Code recap (Blockly)
Let’s explore some of the code used in the previous lessons.
1. Title Name Panel Set (Downloading….):
The Title Name Panel Set block displays a message on the screen. In this
example it will display a “Downloading…” message to notify the user that the program is retrieving data from the cloud.
2. If / else:
The if / else block is used to conditionally run code depending
on whether a Boolean condition is true or false.
In this example, the light will turn on if the light level is less
than 500.
3. Count with:
The count with block executes the same task repeatedly for a specified num-
ber of times. The number of times the code is repeated is specified in the ’to’
block (1). In this example, the code will be repeated 10 times.
4. Light Get Value:
The Light Get Value block returns the value of the light sensor (Returns a numeric value based on the brightness level of
the environment).
5. RGB LED Setting colour with:
The RGB LED Setting colour with block sets the colour of the attached RGB LED.
The colour can be either set manually (3) or controlled by the program UI (2).
6. Set date to:
The Set date to block creates a variable called ‘date’ and stores the current
date/time.
7. Set CPF control request:
Finally, the Set CPF control request block at the end of the program tells the program to run the code from the
beginning again. The program will continuously repeat until the user closes the app or stops the program manually.
3
1
2
3
3 Lesson 20: Project
Code recap (JavaScript)
Let’s explore some of the code used in the previous lessons.
1. cpf.get(“light sensor”);
The cpf.get(“light sensor”); statement returns the value of the light sensor .
(Returns a numeric value based on the brightness level of the environment) and
stores it in a
variable called value. ui.set(“light sensor”, value); reads the value taken from the
light sensor and displays it in the program control Interface (UI).
2. cpf.set(“rgb led”, 0, 0, 0);
The cpf.set(“rgb led”, r, g, b); statement sets the colour of the attached RGB LED.
3. If / else:
The if / else statement is used to conditionally run code
depending on whether a Boolean condition is true or false.
In this example from lesson 1, if the light sensor value is less than (<) 500, the RGB
LED light will light up (based on the values taken from the UI); or else (else), if the
light sensor value is greater than (>) 500, the RGB LED light will