Combination Safe Coding Guide with LEGO SPIKE Prime

Creator Academy Australia · Intermediate ·🛠️ AI Tools & Apps ·6y ago

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 LEGO Wedo 2.0 Kangaroo and Joey Demonstration
LEGO Wedo 2.0 Kangaroo and Joey Demonstration
Creator Academy Australia
2 LEGO Wedo 2.0 Koala Demonstration
LEGO Wedo 2.0 Koala Demonstration
Creator Academy Australia
3 LEGO WeDo 2.0 Eagle vs Rabbit Demonstration
LEGO WeDo 2.0 Eagle vs Rabbit Demonstration
Creator Academy Australia
4 Animatronic Australia: The Kangaroo
Animatronic Australia: The Kangaroo
Creator Academy Australia
5 How Semiconductors Work: 3D Animation
How Semiconductors Work: 3D Animation
Creator Academy Australia
6 LEGO Wedo 2.0 Koala
LEGO Wedo 2.0 Koala
Creator Academy Australia
7 First impressions and unboxing First Lego League: Into Orbit 2018
First impressions and unboxing First Lego League: Into Orbit 2018
Creator Academy Australia
8 FLL Into Orbit Team Ranking Gears talks about Artificial Gravity
FLL Into Orbit Team Ranking Gears talks about Artificial Gravity
Creator Academy Australia
9 FLL Into Orbit team Ev3lution discusses isolation in space
FLL Into Orbit team Ev3lution discusses isolation in space
Creator Academy Australia
10 PI3-BOT (Pie Bot) Prototype
PI3-BOT (Pie Bot) Prototype
Creator Academy Australia
11 Dynamic display stand for LEGO Bugatti Chiron (preview)
Dynamic display stand for LEGO Bugatti Chiron (preview)
Creator Academy Australia
12 Creative Kids TV announcement featuring Creator Academy
Creative Kids TV announcement featuring Creator Academy
Creator Academy Australia
13 LEGO WeDo 2.0 Guided Lesson: Milo
LEGO WeDo 2.0 Guided Lesson: Milo
Creator Academy Australia
14 LEGO SPIKE PRIME: Turtle Prime Demonstration
LEGO SPIKE PRIME: Turtle Prime Demonstration
Creator Academy Australia
15 LEGO SPIKE PRIME "Wheelchair Prime"
LEGO SPIKE PRIME "Wheelchair Prime"
Creator Academy Australia
16 10 Reasons why EV3 is SUPERIOR to SPIKE Prime
10 Reasons why EV3 is SUPERIOR to SPIKE Prime
Creator Academy Australia
17 Your first launch after installing Python: Python for Kids Webinar Highlight
Your first launch after installing Python: Python for Kids Webinar Highlight
Creator Academy Australia
18 What is "Sharpening the Saw": Python for Kids Webinar Highlight
What is "Sharpening the Saw": Python for Kids Webinar Highlight
Creator Academy Australia
19 Why We Use Comments: Python for Kids Webinar Highlight
Why We Use Comments: Python for Kids Webinar Highlight
Creator Academy Australia
20 Build a Scratch Dinosaur Park (Full Lesson)
Build a Scratch Dinosaur Park (Full Lesson)
Creator Academy Australia
21 Scratch 3.0: Cat and Mouse Game Stream (Krunal)
Scratch 3.0: Cat and Mouse Game Stream (Krunal)
Creator Academy Australia
22 Python Tutorial: Make a Toilet Paper Calculator (Full Lesson)
Python Tutorial: Make a Toilet Paper Calculator (Full Lesson)
Creator Academy Australia
23 Scratch 3.0 Tutorial: Making a chatbot that plays 'heads or tails' (Full Lesson)
Scratch 3.0 Tutorial: Making a chatbot that plays 'heads or tails' (Full Lesson)
Creator Academy Australia
24 Getting Started with MicroPython on SPIKE PRIME (old)
Getting Started with MicroPython on SPIKE PRIME (old)
Creator Academy Australia
25 Easter Egg Game Tutorial in Scratch (Full Lesson)
Easter Egg Game Tutorial in Scratch (Full Lesson)
Creator Academy Australia
26 Accessing Weather API with Python (Highlights)
Accessing Weather API with Python (Highlights)
Creator Academy Australia
27 Accessing Translate API with Python (Highlights)
Accessing Translate API with Python (Highlights)
Creator Academy Australia
28 Scissors, Paper, Rock with Scratch 3.0 (Highlights)
Scissors, Paper, Rock with Scratch 3.0 (Highlights)
Creator Academy Australia
29 Making a really scary game with Scratch 3.0 (Highlights)
Making a really scary game with Scratch 3.0 (Highlights)
Creator Academy Australia
30 Making a Lemmings game with Scratch 3.0 (Highlights)
Making a Lemmings game with Scratch 3.0 (Highlights)
Creator Academy Australia
31 Space Navigation Game in Scratch (Highlights)
Space Navigation Game in Scratch (Highlights)
Creator Academy Australia
32 Scratch Supercat Game (Full Lesson)
Scratch Supercat Game (Full Lesson)
Creator Academy Australia
33 Introduction to Robots with LEGO Wedo 2.0 (Full Lesson)
Introduction to Robots with LEGO Wedo 2.0 (Full Lesson)
Creator Academy Australia
34 Getting Started With LEGO Spike Prime (Full Lesson)
Getting Started With LEGO Spike Prime (Full Lesson)
Creator Academy Australia
35 Scratch Walk Cycle Animation Tutorial (Full Lesson)
Scratch Walk Cycle Animation Tutorial (Full Lesson)
Creator Academy Australia
36 Building a Scissor Lift with LEGO Simple Machines (Highlights)
Building a Scissor Lift with LEGO Simple Machines (Highlights)
Creator Academy Australia
37 EV3 datalogging RPM challenge (highlights)
EV3 datalogging RPM challenge (highlights)
Creator Academy Australia
38 Learning about buses with LEGO (Full Lesson)
Learning about buses with LEGO (Full Lesson)
Creator Academy Australia
39 Make "Flappy Bird" in Scratch 3.0 (Highlights)
Make "Flappy Bird" in Scratch 3.0 (Highlights)
Creator Academy Australia
40 "Memory Arrows" game with Scratch 3.0 Lists (Highlights)
"Memory Arrows" game with Scratch 3.0 Lists (Highlights)
Creator Academy Australia
41 Learning about Gear Ratios with LEGO Simple Machines (Highlights)
Learning about Gear Ratios with LEGO Simple Machines (Highlights)
Creator Academy Australia
42 Scratch 3.0 Bouncing Ball with Stretch, Speed and Acceleration (Full Lesson)
Scratch 3.0 Bouncing Ball with Stretch, Speed and Acceleration (Full Lesson)
Creator Academy Australia
43 LEGO SPIKE Prime Order Tracking Robot (Highlights)
LEGO SPIKE Prime Order Tracking Robot (Highlights)
Creator Academy Australia
44 Scratch 3.0 Race Guesser (Full Lesson)
Scratch 3.0 Race Guesser (Full Lesson)
Creator Academy Australia
45 How Banks Work - a quick explanation for kids
How Banks Work - a quick explanation for kids
Creator Academy Australia
46 SPIKE Prime Safe + importance of passwords (Highlights)
SPIKE Prime Safe + importance of passwords (Highlights)
Creator Academy Australia
Combination Safe Coding Guide with LEGO SPIKE Prime
Combination Safe Coding Guide with LEGO SPIKE Prime
Creator Academy Australia
48 LEGO SPIKE Prime Parcel Scanning Robot
LEGO SPIKE Prime Parcel Scanning Robot
Creator Academy Australia
49 Building "Addy" the Addition Chatbot
Building "Addy" the Addition Chatbot
Creator Academy Australia
50 SPIKE 2.x PID Balancer with Scratch for SPIKE Prime / 51515: Gyro Girl
SPIKE 2.x PID Balancer with Scratch for SPIKE Prime / 51515: Gyro Girl
Creator Academy Australia
51 What is Procedural Programming
What is Procedural Programming
Creator Academy Australia
52 Zombie game in SCRATCH (plus horrifying zombie facts!)
Zombie game in SCRATCH (plus horrifying zombie facts!)
Creator Academy Australia
53 Swarming Bugs Scratch Game
Swarming Bugs Scratch Game
Creator Academy Australia
54 LEGO Mindstorms/SPIKE Prime Scanner and Printer
LEGO Mindstorms/SPIKE Prime Scanner and Printer
Creator Academy Australia
55 Fishing Game with SCRATCH (For Fathers Day!)
Fishing Game with SCRATCH (For Fathers Day!)
Creator Academy Australia
56 Measuring Paper Plane Speed with SPIKE Prime Line Graphs
Measuring Paper Plane Speed with SPIKE Prime Line Graphs
Creator Academy Australia
57 Comparing Mindstorms Robot Inventor and SPIKE Prime
Comparing Mindstorms Robot Inventor and SPIKE Prime
Creator Academy Australia
58 Code a 'Knock Knock Joke' game in Scratch 3.0
Code a 'Knock Knock Joke' game in Scratch 3.0
Creator Academy Australia
59 Creator Academy Australia Live Stream
Creator Academy Australia Live Stream
Creator Academy Australia
60 Discovering LEGO Mindstorms/SPIKE Gyro Pitch Deadzone
Discovering LEGO Mindstorms/SPIKE Gyro Pitch Deadzone
Creator Academy Australia

Related Reads

Up next
monday.com Automation: Fix Missing Emails in Seconds
Mastering monday
Watch →