lesson 6 - eu-acerforeducation.acer.com · 2 lesson 6: cloud download 1. onnect the power of...

5
1 Lesson 6: Cloud Download What you will need CloudProfessor (CPF) Temperature sensor Arduino Leonardo Arduino Shield USB cable Learning Expectaons (how learning / progress will be demonstrated) All Download temperature data taken from the CloudProfessor from cloud storage. Most Use variables in their app. Some Explain the benefits and drawbacks of cloud storage. Learning Objecves Use cloud storage to download temperature data. Understand and use variables Understand the benefits and drawbacks of cloud storage. Overview In the previous lesson, students learned how to upload the value measured by the temperature sensor to the cloud storage. In this lesson, students will learn how to download the data from the cloud onto their mobile device. 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 6 Cloud Download 1

Upload: others

Post on 12-Sep-2019

2 views

Category:

Documents


0 download

TRANSCRIPT

1 Lesson 6: Cloud Download

What you will need

• CloudProfessor (CPF)

• Temperature sensor

• Arduino Leonardo

• Arduino Shield

• USB cable

Learning Expectations (how learning / progress will be demonstrated)

All Download temperature data taken from the CloudProfessor from cloud storage.

Most Use variables in their app.

Some Explain the benefits and drawbacks of cloud storage.

Learning Objectives

Use cloud storage to download temperature data.

Understand and use variables

Understand the benefits and drawbacks of cloud storage.

Overview

In the previous lesson, students learned how to upload the value measured by the temperature sensor to the cloud storage.

In this lesson, students will learn how to download the data from the cloud onto their mobile device.

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 6 Cloud Download

1

2 Lesson 6: Cloud Download

1. Connect the power of CloudProfessor then press and hold the power button for two seconds; it will turn on and the

power indicator will light up.

2. Insert the Arduino Shield into Arduino Leonardo and use the USB cable to connect the CloudProfessor with Arduino

Leonardo. Attach the temperature sensor to port A1.

3. When the CloudProfessor detects the Arduino Leonardo, a notification will appear on your device; click the

notification to launch the Arduino Leonardo APP, and then select the CPF Arduino Blockly app. Click on Lesson 6.

4. Press the execute button to enter the control user interface (UI).

5. Press the edit button to enter the program editing page.

Step-by-step instructions 2

1

2

3

CPF Arduino Blockly app

Edit button

Execute button

Control user interface (UI) Program editing page

3 Lesson 6: Cloud Download

Exploring the code (Blockly)

Let’s explore the code.

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. Count with:

The count with block executes the same task repeatedly for a

specified number of times. The number of times the code is re-

peated is specified in the ’to’ block (1). In this example, the code

will be repeated 10 times.

3. Set aop_obj to:

The Set aop_obj to block creates a variable called “aop_obj” and stores the JSON object containing the data

uploaded in the previous lesson.

4. Title Panel Set:

The Title Panel Set block reads the

contents of the JSON object containing

the data, uploaded to the cloud in the

previous lesson, and displays it on the

screen (2).

Note: If any error messages appear on the screen, it might be because

you did not finish uploading all 10 data entries in the previous lesson.

5. Title Name Panel Set:

The Title Name Panel Set block displays a message on the screen. In this

example it will display a “Downloading finished” message to notify the user that the program has finished retrieving

data from the cloud.

3

Try changing the order of the text that is displayed on the screen. Add an If/else condition that only displays

the data if the msg value = “Hot! Hot! Hot!”.

2

1

4 Lesson 6: Cloud Download

Exploring the code (JavaScript)

Let’s explore the code.

1. ui.set(“title”, “Downloading….”);

The ui.set(“title”) statement 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. for (index=1; index<=10; index++) {

The for() statement executes the same task repeatedly for a specified

number of times. The number of times the code is repeated is specified

in the first two sections of the for loop (1). In this example, the code will

be repeated 10 times.

3. aop.getStore();

aop.getStore(); is a CloudProfessor API; it is used to download the

data saved on the CloudProfessor Cloud Platform (see lesson 5).

4. obj.temperature, obj.message and obj.date;

obj.temperature, obj.message and obj.date are used to retrieve the results from the cloud. For each piece of data

downloaded (temperature, message and date), the data is combined with a description (text += “temperature = “ +

obj. temperature + “\n”;) by concatenating (’+’ command) the description with the data. In the program, “\n”

means line break; line breaks are used to make the output look cleaner and neater. After downloading, ui.set() is

used to display the downloaded data on the screen (2).

Note: If any error messages appear on the screen, it might be because

you did not finish uploading all 10 data entries in the previous lesson.

5. ui.set("title", "Download finish");

The ui.set("title", "Download finish"); line displays a message on the screen. In this example it will display a

“Download finished” message to notify the user that the program has finished retrieving data from the cloud.

3

Try changing the order of the text that is displayed on the screen. Add an If/else condition that only displays

the data if the message value = “Hot! Hot! Hot!”.

2

1

5 Lesson 6: Cloud Download

Extension

Students to take a screenshot of their code and add comments to explain how it works.

Differentiation

To support students, provide step by step guides.

To stretch students ask them to create a flowchart / pseudocode of their code first or code their solution using JavaScript.

Homework

Students to write up a summary of what they’ve learned; students to include screenshots and snippets of their code in

their summary.

Students to research about cloud storage. Students to consider in their research: cost, advantages vs disadvantages,

availability, storage limits etc.

Links

Sample weather data from weather stations across the UK: http://weather.lgfl.org.uk

How cloud storage works: http://computer.howstuffworks.com/cloud-computing/cloud-storage.htm

Benefits of data logging: http://www.bbc.co.uk/schools/gcsebitesize/ict/measurecontrol/3dataloggingrev3.shtml

Disclaimer: Use these sites at your own risk. Acer is not responsible for the content of external Internet sites. We

recommend that you check the suitability of any recommended websites links before giving them to students.

4

5

6

7