Combination Safe Coding Guide with LEGO SPIKE Prime
Key Takeaways
Creates a combination safe using LEGO SPIKE Prime and Scratch 3.0 lists
Full Transcript
going to learn about how to use lists lists are very very hard to work with especially for someone who is just learning how to code and we have done lots of coding before but lists are usually what separates people who know a little bit of coding and coding all right so even if you don't understand it I want to make sure that you have a go of it today okay it is not easy all right so don't feel bad if if you don't get it working the first time around you can ask me questions after the lessons all right first of all let's open Spike prime and let's get into your code don't worry I'll just load up the code from the keep it safe module all right let's have a look at this so remember the first things we did you might already have this but even if you don't make sure you do this okay so we go into your mailbox and then I think we we got one called open and then we had and then we go save and then we also made one for clothes right when save right so this was our code from last week so when starts we lock it and then we do the left right left to open it okay so I'm just going to connect up my robot you I hit mine connect I'm gonna try and connect my bruises nope so it's connected successfully if it doesn't connect my blue cheese for you then just connect with the cable okay let's run this code let's go see what does so I pressed play yep so it just made a sound because it's locked my my safe - locked my safe and I can't open it but I mean I can't take the Lego wrap and that's not fun right it's locked my safe so now I need to go left right lift and then it unlocks it and then I can open it up again right but remember what's wrong with my same the thing that is wrong with it is that left right left is a really easy password to guess and it doesn't punish me if I entered the wrong code alright so today we're going to learn how to organize it so that we can punish someone for entering the wrong code how are we going to do that how are we going to do that well let me tell you what we are going to do we're gonna make it so that every time you press a button it doesn't matter if the left button or the right button we are going to record that press on a list and every time a button is pressed on and we add that button to the list we are going to check that list we're going to get rid of this code after the left button is press because that's not useful anymore second thing is we're going to go into variables and then we're going to make a list we're going to get cold button pressors now like I said don't worry about doing the code yet okay I just want you to have a look first you button presses when left button is clicked and also I want to make it so that there is a one for when right button is pressed okay but instead of pressed I want it to be released same with filete but when red button is released that way we are only going to record it once you crushed it and then released it right when left button is releasing when right button is released what are we going to do when the left button is released or when rappin is released well we're going to add something to the list we're going to go in variables and then we're going to add something to the button presses when left button is pressed we add a 1 button presses when right button is pressed we add a number two to button presses and also when when we start the program we need to delete all of presses so we make a list called button presses and then when we press on the Left button well when we release the left button then we add one to the button presses and we when we released the right button we added two to the button presses alright so now we need to have a function to check our list because if the list has three button presses in it we need to check if it is equal to one to one okay so we're going to check the list every time we press or we release a button and if there are three items there then we are going to check if it's one to one if it's not one to one then we punish the person but if it is once you want then we unlock the lock does that make sense so this is how you do that so we go control and then if then block okay and then if go into variables and then you go lengths of button presses so we wanted to make sure that if it is equal to three so we go into operators equal to three if the button presses in your in your length the length of button presses is equal to three then we're going to do a check yet okay the same with the the the right button press but we're going to do this bit first okay so we're going to create a my book called check combination okay so my block and make a block check on the nation then we go and now you'll have a check combination [Music] block over here down here so here we go check combination when after this so and then we copy this bit of the code the if block and then add it to the right button as well so if the button presses is more is equal to three then we're going to check the combination what are we going to do when we check the combination all here this is where it starts to get tricky okay go like this well again if and else okay if operator and then we need to Anne's okay so we need an and and and and and because we want to make if the first one is one the second item is two and the third item is one they copy this down continue copying so we go into variables if item one of button presses is equal to 1 right so we're going to operators we go equal to 1 and then we need item 2 of operator is equal to 2 and then the third item is also equal to one you and then we're checking the first item the second item and then a third item of baton presses so now we go into variables so your item one of bun tresses an item to of button presses and finally we got item three button presses if all that checks out then we unlock we open the safe otherwise what do we do we what do we do we delete everything inside the combinations so we go into variables and then we go delete all off button presses and then we forced them to wait for two seconds there we go wait two seconds and this is the punishment waiting for two seconds and then you can also have am and happy and happy face for two seconds you so now it's testing it starts off locked then if I entered the wrong code then it's giving me an unhappy face keeps giving me unhappy face when I enter the wrong code you right but when I entered the right code it unlocks you
Original Description
In this lesson, we extend on the LEGO SPIKE Prime "Keep It Safe" lesson by teaching you how to create a proper combination safe by using Scratch 3.0 lists.
Enjoy this preview of the Robotics course from Creator Academy.
For more in-depth science, building and coding on this subject, visit www.creatoracademy.com.au
LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorise, or endorse this video.
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Creator Academy Australia · Creator Academy Australia · 47 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
▶
48
49
50
51
52
53
54
55
56
57
58
59
60
LEGO Wedo 2.0 Kangaroo and Joey Demonstration
Creator Academy Australia
LEGO Wedo 2.0 Koala Demonstration
Creator Academy Australia
LEGO WeDo 2.0 Eagle vs Rabbit Demonstration
Creator Academy Australia
Animatronic Australia: The Kangaroo
Creator Academy Australia
How Semiconductors Work: 3D Animation
Creator Academy Australia
LEGO Wedo 2.0 Koala
Creator Academy Australia
First impressions and unboxing First Lego League: Into Orbit 2018
Creator Academy Australia
FLL Into Orbit Team Ranking Gears talks about Artificial Gravity
Creator Academy Australia
FLL Into Orbit team Ev3lution discusses isolation in space
Creator Academy Australia
PI3-BOT (Pie Bot) Prototype
Creator Academy Australia
Dynamic display stand for LEGO Bugatti Chiron (preview)
Creator Academy Australia
Creative Kids TV announcement featuring Creator Academy
Creator Academy Australia
LEGO WeDo 2.0 Guided Lesson: Milo
Creator Academy Australia
LEGO SPIKE PRIME: Turtle Prime Demonstration
Creator Academy Australia
LEGO SPIKE PRIME "Wheelchair Prime"
Creator Academy Australia
10 Reasons why EV3 is SUPERIOR to SPIKE Prime
Creator Academy Australia
Your first launch after installing Python: Python for Kids Webinar Highlight
Creator Academy Australia
What is "Sharpening the Saw": Python for Kids Webinar Highlight
Creator Academy Australia
Why We Use Comments: Python for Kids Webinar Highlight
Creator Academy Australia
Build a Scratch Dinosaur Park (Full Lesson)
Creator Academy Australia
Scratch 3.0: Cat and Mouse Game Stream (Krunal)
Creator Academy Australia
Python Tutorial: Make a Toilet Paper Calculator (Full Lesson)
Creator Academy Australia
Scratch 3.0 Tutorial: Making a chatbot that plays 'heads or tails' (Full Lesson)
Creator Academy Australia
Getting Started with MicroPython on SPIKE PRIME (old)
Creator Academy Australia
Easter Egg Game Tutorial in Scratch (Full Lesson)
Creator Academy Australia
Accessing Weather API with Python (Highlights)
Creator Academy Australia
Accessing Translate API with Python (Highlights)
Creator Academy Australia
Scissors, Paper, Rock with Scratch 3.0 (Highlights)
Creator Academy Australia
Making a really scary game with Scratch 3.0 (Highlights)
Creator Academy Australia
Making a Lemmings game with Scratch 3.0 (Highlights)
Creator Academy Australia
Space Navigation Game in Scratch (Highlights)
Creator Academy Australia
Scratch Supercat Game (Full Lesson)
Creator Academy Australia
Introduction to Robots with LEGO Wedo 2.0 (Full Lesson)
Creator Academy Australia
Getting Started With LEGO Spike Prime (Full Lesson)
Creator Academy Australia
Scratch Walk Cycle Animation Tutorial (Full Lesson)
Creator Academy Australia
Building a Scissor Lift with LEGO Simple Machines (Highlights)
Creator Academy Australia
EV3 datalogging RPM challenge (highlights)
Creator Academy Australia
Learning about buses with LEGO (Full Lesson)
Creator Academy Australia
Make "Flappy Bird" in Scratch 3.0 (Highlights)
Creator Academy Australia
"Memory Arrows" game with Scratch 3.0 Lists (Highlights)
Creator Academy Australia
Learning about Gear Ratios with LEGO Simple Machines (Highlights)
Creator Academy Australia
Scratch 3.0 Bouncing Ball with Stretch, Speed and Acceleration (Full Lesson)
Creator Academy Australia
LEGO SPIKE Prime Order Tracking Robot (Highlights)
Creator Academy Australia
Scratch 3.0 Race Guesser (Full Lesson)
Creator Academy Australia
How Banks Work - a quick explanation for kids
Creator Academy Australia
SPIKE Prime Safe + importance of passwords (Highlights)
Creator Academy Australia
Combination Safe Coding Guide with LEGO SPIKE Prime
Creator Academy Australia
LEGO SPIKE Prime Parcel Scanning Robot
Creator Academy Australia
Building "Addy" the Addition Chatbot
Creator Academy Australia
SPIKE 2.x PID Balancer with Scratch for SPIKE Prime / 51515: Gyro Girl
Creator Academy Australia
What is Procedural Programming
Creator Academy Australia
Zombie game in SCRATCH (plus horrifying zombie facts!)
Creator Academy Australia
Swarming Bugs Scratch Game
Creator Academy Australia
LEGO Mindstorms/SPIKE Prime Scanner and Printer
Creator Academy Australia
Fishing Game with SCRATCH (For Fathers Day!)
Creator Academy Australia
Measuring Paper Plane Speed with SPIKE Prime Line Graphs
Creator Academy Australia
Comparing Mindstorms Robot Inventor and SPIKE Prime
Creator Academy Australia
Code a 'Knock Knock Joke' game in Scratch 3.0
Creator Academy Australia
Creator Academy Australia Live Stream
Creator Academy Australia
Discovering LEGO Mindstorms/SPIKE Gyro Pitch Deadzone
Creator Academy Australia
More on: AI Pair Programming
View skill →Related Reads
📰
📰
📰
📰
Why AI Makes Legacy Modernization More Feasible But Not More Automatic
Forbes Innovation
AI Stack Online Training | New Batch Starts Soon!
Medium · Python
I Started Tracking How Much Time I Spent Correcting AI Output. The Number Changed Everything.
Dev.to · Avery
The Top 5 AI Tools You Can Use Every Day to Save Hours
Medium · ChatGPT
🎓
Tutor Explanation
DeepCamp AI