Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Programming and Physical Computing

Similar presentations


Presentation on theme: "Introduction to Programming and Physical Computing"— Presentation transcript:

1

2 Introduction to Programming and Physical Computing
2 PicoBoard and Scratch Introduction to Programming and Physical Computing One prebuilt of each circuit for each group, who has what experience?

3 Workshop Overview Introductions The Learning Cycle (STEM  STEAM)
3 Introductions The Learning Cycle (STEM  STEAM) What is physical computing Introduction to Scratch and animating a character Connecting to the outside world -- Plugging in the picoboard Slider Additional resources

4 Time to play, reflect, question and redesign
4 The Learning Cycle Time to play, reflect, question and redesign We are putting constructivism in the hands of the teachers and schools as well as the kids

5 General Rules… Raise your hand if you have a question. Be respectful. When I raise my hand… Share your findings with the people near you. Poke around, experiment, and have fun… Imagine, create, and play!!!

6 About Us SparkFun Electronics is all about creation, innovation and sharing information. We want to get you excited about cutting edge electronics technology with our hands on educational kits.

7 What is Physical Computing
7 What is Physical Computing Physical computing, in the broadest sense, means building interactive physical systems by the use of software and hardware that can sense and respond to the analog world -Wikipedia

8 Resources This PPT  les/Getting_Started_With_PicoBoards.pdf

9 What is Scratch? Scratch is a programming language that makes it easy to create your own interactive stories, animations, games, music, and art -- and share your creations on the web. Named “Scratch” because it’s embodied after how DJs re-mix the work of other users. It is intended that users download and re-mix other users’ projects. Welcome to  Open Source Software

10 10 Scratch Double-click to start the video. 40 second video

11 With the PicoBoard, your Scratch™ projects can sense – and respond to – things going on in the world outside your computer.

12 Creating your first Animation

13 Parts of the Screen Rotation Settings– Control how the sprite rotates:
- rotate freely - face left \ right - locked (no rotation) 13 Palette – Each of the 8 buttons will show you different functions Parts of the Screen Sprite Toolbar – Duplicate, Delete, Grow, Shrink Click & Drag Scripting Area Here’s where you build your program – stacking blocks togeteher to create unique functions. Have people open up scratch now – as you point out some of the features. Resist the temptation to go into too much detail about the different blocks, code organization, etc… Just define the areas.

14 Scratch Exercise 1 Choosing a Sprite and making it move in 4 directions

15 Choosing your Sprite (Import from library)
A Sprite is any character or object in your game.  Sprites can move and be active or be props that stay still.  We will choose a Sprite character that will move about your screen. Click on the Costumes Tab Click Import Select a Folder (Animals, People, Things) Pick a Sprite! (Double-Click)

16 Choosing your Sprite (Camera!)
If your computer has a built-in camera, you can also take a picture of something you’ve drawn or created. You can use this to create stop-motion animations (think clay-mation \ Gumby…) Or… you can use the Paint option window to draw your own sprite

17 Picking a Background (Stage)
Click on the Stage (lower right) Click the Backgrounds Tab Use the Paint / Import / Camera feature to pick your background.

18 Making Your Sprite Move
Sprites can not do anything by themselves.  A Sprite's action comes from the scripts in the script window.  Scripts are the instructions for exactly what the sprite will do.  You drag these instructions from the Tile pane into the "Scripts" pane.  Tiles fit together like a puzzle to create the instructions.

19 Event driven instructions
Click the Control button on the scripting palate. There are 3 different events that you can use to trigger an instruction (code). Click and drag one of these over to the scripting area.

20 Making Your Sprite Move…
Click on the "Motion" button. Drag "point in direction [90]" over to the Scripts window and connect it to the previous command. Drag the “move [10] steps" tile and connect it. Test it 

21 Adding animation… Scratch moves around – but doesn’t look like she’s actually walking. Click on Add the next costume block to our script. Test it 

22 Play time… Build an animation to introduce yourself to the class. Choose what key you will use to start. Play with the various features / programming blocks in scratch. Here are some examples:

23 Back to building simple motion
Save your introduction script. All files save as *.sb Start a new file that looks like this 

24 Adding other controls make your sprite move backwards with another key press.
Right-click on the code block to copy (duplicate) what you’ve already done. Click the box where it says space and change this to a different key.

25 Voilla. You’ve just created “game controls” for your character
Voilla! You’ve just created “game controls” for your character. What else can you do?

26 Plug it in the PicoBoard…

27 Sensors

28 Sensor Values By default, all sensor values vary from 0 to 100. Use this with Control Blocks to create conditional statements and integrate decision-making.

29 Light Value Your sprite can react to light or shade using the data coming from this sensor. One of the examples in Scratch uses the light sensor in an interesting animation of the Sun.

30 Slider Value This sensor is useful because instead of being a binary sensor, like the button sensor (which turns on or off), this sensor changes continuously on a scale from 0 to 100.

31 Sound Value Your sprite can be programmed to react when this sensor detects sound. For example, a sprite can jump up in surprise if you yell into the sensor, but perhaps not do anything if you simply whisper into the sensor.

32 Button State (Boolean)
Your sprite can be programmed to react when you push this button. Make your sprite jump or change colors. When you stop pushing the button, the sprite will go back to its original state.

33 Example: Slider Control
Start with the slide potentiometer. Input Values: 0 – 100 Take these blocks and make this:

34 Scratch Scratch rotates from 0 degrees to 100 degrees How can we use this to get her to rotate a full circle?

35 Math Lesson: Rotating a full circle = 360 deg

36 Rotating a full circle = 360 deg
Using the palette, pull out the divide and the multiply blocks. Combine these to get the desired formula.

37 Like this?

38 Drop this into where you had the angle before

39 Conditional (Boolean) Statements
if (<>) { // do something } <Boolean statement> Can be: TRUE or FALSE Assemble these together:

40 Put this all into the forever() loop

41 Making it better? Add the pen to Scratch so you can track the path of the animation. Can you draw out your initials with this? Can you draw a smiley?

42 Graphical Effects Play around with the different graphical effects under Looks Drop the slider control in to add control. Remember this needs to be inside the forever()

43 Building a game. Step 1: Concept design Step 2: Storyboarding Step 3: Prototype / Code Step 4: User beta testing Step 5: Presentation

44 Adding other features Using the slider to control left-right (x position) Use the button to “jump”

45 Creating a new costume Click Copy Click Edit on the new costume (costume3)

46 Use the Paint Bucket tool to color in Scratch

47 When the light level gets dark, change costume
What are the light levels in this room? After you click the checkbox, you should see this  upper left corner

48 Setting thresholds Use the Greater Than \ Less Than Comparison blocks and the if() block to control when your character changes costumes.

49 Additional Challenges for Today
Use the slider to control the direction of the character. Use the light sensor, program a sprite to hop up and down whenever a shadow passes by. Use the slider and button to control a character in a video game. Use the sound sensor, you can make a sprite change how it looks whenever there is a loud sound. Other ideas???

50 What else can Scratch do in my class?

51 Graphing & Data Logging with Scratch

52 Other Cool animations 5/Day%20Dream.sb

53 53 Questions?

54 www.sparkfun.com 6175 Longbow Drive, Suite 200 Boulder, Colorado 80301
54 6175 Longbow Drive, Suite 200 Boulder, Colorado 80301


Download ppt "Introduction to Programming and Physical Computing"

Similar presentations


Ads by Google