Introduction In this book you will learn how computer technology is used in modern homes and buildings You’ll find out about how this technology is changing the way we live making our lives easier and our homes more secure We’ll spend some time looking at how some devices use smart technology We will also have a look inside the computer code that connects the components and brings devices to life You’ll use the algorithms and ideas that are used to control devices within buildings to create your own coding programs These programs will help you understand how things work and set you on the road to dreaming up your own ideas for a house of the future There are a lot of different ways to create code We will be using a website called Scratch to do our coding Type scratch mit edu into your web browser then click Create to start a new project 4
Let’s start by looking at the important Let’s start by looking at the important parts of the screen in Scratch parts of the screen in Scratch File Menu for logged-in users If you want you can create an account for free and save your work online Check with a grown-up first Or you can use the Load and Save options to open and save work on your computer Sound Library Add sounds to your program from here All Animals Effects Loops Notes Percussio New Save Now Save as a Copy Go to My Stuff New Load from your computer Upload to your computer Save to your computer Download to your computer Record and Export Video Revert File Menu for general users Choose Load and Save to open and save work on your computer File Edit Tutorials Code Costumes Sounds Block Categories Choose commands from these categories or just scroll through them all Motion move 10 steps turn 15 degrees turn 15 degrees Motion Looks Sound Events Control go to random position Sensing go to x 0 y 0 Operators glide 1 secs to random position Variables glide 1 secs to x 0 y 0 My Blocks point in direction 90 point towards mouse-pointer change x by 10 set x to 0 change y by 10 set y to 0 List of Commands Find the blocks you need by matching the color to the category name For example dark blue blocks will be found in the motion category Sprite Library Choose ready-made sprites for your programs Ballerina-c Ballerina-d Balloon1-a Bananas Baseball Basketball A Bass A Elec Bass A Elec Guitar A Elec Piano A Minor Uk A Piano A Sax A Trombone Scripts Area Add your commands or code here Sprite1 Sprite1 Stage Backdrops The Stage Your program takes place on the Stage Sprites Objects that move around in Scratch are called sprites Sprites Pane Select which of your sprites you want to add code or sound to in this area Code Costumes Sounds costume3 Paint Editor This is where you can draw your own sprites or backdrops Costume Pane Drawing Tools 5
Smart Homes Technology has always played a big role in homes and other buildings Over 2,000 years ago the ancient Romans invented a system that used hot air under floors to heat homes Homes used to be lit with candles This gave way to gas-powered and then electric lights Today new inventions continue to improve buildings Computers are now taking an ever-increasing role in how different parts of a building work Let’s build our own house with code to see how this works The house will have a number of automatic lights and music that switch on and off as the Scratch Cat walks around STEP 1 The Stage We need to draw the background first so click Stage in the Sprites pane Stage Backdrops STEP 2 The Backdrop Backdrops Click the Backdrops tab For help go to www maxw com 6
STEP 3 The sky Convert to Bitmap Click Convert to Bitmap Choose a light blue Select the Fill tool Click in the drawing area to create the sky Click the Undo tool if you make a mistake STEP 4 The ground Filled Outlined Choose dark green Select the Rectangle tool Set the rectangle to Filled Make a long thin rectangle at the bottom to draw the ground STEP 5 Draw the house We need to draw things inside the house so just draw a simple silhouette of the house in white Choose white 15 Pick the Line tool Make the line thicker Choose the Fill tool Use the mouse to draw a large rectangle for the main part of the house Draw three lines to give the house a roof Click inside the roof to fill it in with white If the color leaks outside the house click Undo and look for any gaps between your lines Join them up 7