coding by: katie xxxxxx. agenda programming languages hardware coding example 1: hello world coding...

21
Coding By: Katie XXXXXX

Upload: may-austin

Post on 28-Dec-2015

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

CodingBy: Katie XXXXXX

Page 2: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Agenda

Programming Languages

Hardware

Coding Example 1: Hello World

Coding Example 2: Fibonacci Sequence

Coding Example 3: Balloon POP!

More Examples

Resources

Page 3: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Programming LanguagesSCRATCH: A beginners language designed to make programming fun for small kids.

PYTHON: A powerful, easy to learn, and widely used programming language.

JAVA: A very popular programming language especially for web-based applications.

C/C++/C#: A set of low level programming languages. Very powerful, extremely widely used, hard to learn.

Dozens, if not hundreds, of more obscure programming languages.

Page 4: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Programming Language Selection

For elementary school aged kids, SCRATCH is probably the best choice.

PYTHON is generally considered the best learning language. It's powerful, quick to learn, and makes it easier to learn the other languages like JAVA and C later.

Page 5: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Hardware

IPAD: iPads are made to be simple to use making it hard to program on them.

PC/Laptops: Powerful platforms for coding. Expensive. Hard to interface with electronics.

Raspberry Pi: A computing platform designed to get kids interested in programming, and to be about the cost of a school textbook.

Page 6: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Hardware: Raspberry PI

The Raspberry Pi is a credit card sized computer, costing between $25 and $35 (depending on version). It was originally designed to get kids interested in coding.

Over 5 million have been sold (mostly to non-kids to play with). It was originally designed to help kids learn PYTHON, but all of the languages named on the previous slides are supported.

Page 7: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

HARDWARE: Eben Upton

The idea for the Raspberry Pi came about because the Cambridge Computer Lab saw both a decline in the number of applicants for their C.S. Course, and a drop in the number that had programming experience.

Eben Upton initially hoped to sell 20,000.

Page 8: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Coding Example 1: Hello World!

A simple, one line program in Python, printing words to the screen:

print ("Hello World!")

Page 9: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Coding Example 1a: Adding Variables

Variables store data. This program asks the user their name, then says hello to them:

name = input("What is your name? ")print ("Hello %s!" % name)

Page 10: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Coding Example 1b: IF statements

IF statements let us look at variables and do different thing depending what is in them. Note, Alex is my brother and messes with my stuff:

name = input("What is your name? ")if name.lower() == 'katie': print ('Katie is Awesome!')elif name.lower() == 'alex': print ('GO AWAY ALEX!!!')else: print ("Hello %s!" % name)

Page 11: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Coding Example 2: Fibonacci Sequence

Amongst other things Fibonacci sequence can predict bunny populations.

bunnies, baby_bunnies = (1,1)

generations = int(input('How many generations do you want? '))

for x in range(1, generations+1): print ('Generation {} has {} baby bunnies'.format(x, baby_bunnies)) bunnies, baby_bunnies = (baby_bunnies, bunnies + baby_bunnies)

Page 12: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Coding Example 3: Balloon Pop!

Using a pin to pop a balloon is cheating, and uses ancient technology import RPi.GPIO as GPIOfrom time import sleep

GPIO.setup(26, GPIO.OUT)answer = input('Do you want to pop the balloon? ')if answer.lower() == 'yes': GPIO.output(26, True) sleep(10) GPIO.output(26, False)else: print ('Save the balloons!')

Page 13: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Balloon pop circuit diagram

The transistor is being used as a switch. When the raspberry pi turns on pin 26 the transistor switches on. This allows a lot of current to flow through the resistor, which gets very hot and pops the balloon.

Page 14: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

More Examples

As Eben Upton says, the Raspberry Pi “puts a space program within the reach of every primary (elementary) school in the world”

The following slides show some ways Raspberry Pi's have been used.

Page 15: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

My 3D Printer

lThis was the 3-D printer that I made for my GT project and it is controlled by a raspberry pi that lets me upload files and control it from my iPad or other computers.

Page 16: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Pi's with Weather Balloons

Raspberry pi's have been sent up to the edge of space in a weather balloon to take a picture of a potato in a space ship.

Page 17: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

More about weather balloons

o Weather balloons can be launched for around $400.o They typically go over 100,000 feet before popping.o Flight time is usually 2-3 hours.o Usually fly 50 miles or less.o Payload can be up to 12lbs.

Page 18: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Quad-copter

Semi-autonomous quad-copter that you can program your own flight plan on.

Page 19: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Erica the Rhino

Erica is powered by five raspberry pi's that allow the rhino to move it's ears, send out and read tweets, make rhino sounds, and even interact with nearby smartphones.

Page 20: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Minecraft Pi

In Minecraft you can use python to create objects, build games, and even link it to a webcam to take real pictures to use in the game.

Page 21: Coding By: Katie XXXXXX. Agenda Programming Languages Hardware Coding Example 1: Hello World Coding Example 2: Fibonacci Sequence Coding Example 3: Balloon

Other resources

https://www.raspberrypi.org/resources/teach/https://www.raspberrypi.org/resources/learn/https://www.raspberrypi.org/resources/make/