Lab 1: Events and Queries
- Due Jan 20, 2018 by 11:59pm
- Points 100
- Submitting a text entry box, a media recording, or a file upload
Objective
The objective of this lab is to gain an understanding of how picos communicate with each other and how they react to those communications.
Reading and Reference
Read the following:
You may find the following resources useful:
Prerequisites
You should have completed:
Implementation Notes
- The best way to use the KRL documentation is to search since you may not always appreciate how it's organized (or isn't).
- People often can't get their ruleset to run because it doesn't parse. Make sure you always parse your ruleset before checking it into whatever system you're using to store it (probably GitHub).
- If your changes don't seem to take effect, the most common cause is likely that GitHub's internal caching is returning the old ruleset even though you've checked in changes. Try waiting 5 minutes, refreshing, and trying again. Alternatively, register your changed ruleset code through the Engine Rulesets page.
- Note that if you have two rules in your installed rulesets that select on the same event, then they will both fire when the pico sees that event.
- You can do this entire lab in one pico. You can do it in your account's primary pico, or you can create a child pico and install the rulesets there.
Do This
Complete the following in the pico that you installed in the hello_world
ruleset of Lab 0.
- Create a new channel (pick any name and type you like).
- Send an event to the pico using the new channel and the original (default) channel.
- Do you get the same result on both? Why or why not?
- Delete the channel.
- Resend the event using the deleted channel.
- What happens? Why?
- Send the misspelled event
ecco/hello
to your pico. What do you observe? Why? - Add a new rule to the
hello_world
ruleset that selects onecho/monkey
and responds with "Hello Monkey" unless an event attribute namedname
is given, in which case it will respond with "Hello " followed by the given name. Hint: use the.defaultsTo()
operator. Use the.klog()
operator to log the value that is used. - Repeat the previous step using the ternary conditional
Links to an external site. instead of the
.defaultsTo()
operator.
Deliverables
Turn in the following:
- URLs for your ruleset(s)
- Short screencast (< 3 min with sound) showing the results from (4) and (5) above
- Answers to any questions posed in the preceding "do this" section.
Rubric
Please include a title
Criteria | Ratings | Pts | ||
---|---|---|---|---|
URLs
Host this code on github and provide the url to the rulesets.
threshold:
pts
|
|
pts
--
|
||
Screencast
threshold:
pts
|
|
pts
--
|
||
Answers to Questions
Please provide this separately from the screencast.
threshold:
pts
|
|
pts
--
|
||
Total Points:
100
out of 100
|