bigguyinabowtie.combigguyinabowtie · myled = led(17) while true: myled.on() sleep(1) myled.off()...
TRANSCRIPT
![Page 1: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/1.jpg)
@KSUiTeach
Visit: ksuiteach.org Visit: seeedudifferently.com Presentation is at: bigguyinabowtie.com/Google Check out my Youtube Channel! http://bit.ly/bigguybowtievideo Follow me on Twitter, Instagram, and Snapchat @bigguyinabowtie big
guyin
abow
tie.co
m
![Page 2: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/2.jpg)
@KSUiTeach
Idea Share!
How would you use Raspberry Pi? Share Your thoughts here
Prize at the end for a favorite and random
monthly prizes
http://bit.ly/raspberrypiideashare
biggu
yinab
owtie
.com
![Page 3: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/3.jpg)
@KSUiTeach
It can do everything! Creating with
Raspberry Pi and Components
Presented by David Lockhart biggu
yinab
owtie
.com
![Page 4: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/4.jpg)
@KSUiTeach
About Me
biggu
yinab
owtie
.com
![Page 5: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/5.jpg)
@KSUiTeach
biggu
yinab
owtie
.com
![Page 6: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/6.jpg)
@KSUiTeach
Our AgendaAbout The Big Guy in the Bow Tie Circuit TimeChallenge 1: Building an LED CircuitChallenge 2: Traffic LightPi CameraChallenge 3: SelfieChallenge 4: Add a ButtonChallenge 5: Use FiltersChallenge 6: Video
Challenge 7: Motion Sensor
Challenge 8: Time LapseChallenge 9: Create Your
Ownbig
guyin
abow
tie.co
m
![Page 7: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/7.jpg)
@KSUiTeach
Circuit TimeScratch & Python & Circuits
© CC BY-SA 4.0
biggu
yinab
owtie
.com
![Page 8: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/8.jpg)
@KSUiTeach
Things You Will Need
2X Male/Female Jumper WiresLED
Resistor
BreadboardGPIO Reference Boardbig
guyin
abow
tie.co
m
![Page 9: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/9.jpg)
@KSUiTeach
Simple CircuitYour Raspberry Pi can act as the power supply for simple circuits.
biggu
yinab
owtie
.com
![Page 10: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/10.jpg)
@KSUiTeach
Challenge 1: Building and
Coding an LED Circuitbiggu
yinab
owtie
.com
![Page 11: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/11.jpg)
@KSUiTeach
Code Your Raspberry Pi•Find this Slide Deck on the Raspberry Pi Playground at https://
goo.gl/XhMwdC
•Using the next few slides build an LED circuit, and code it in both Scratch and Python
•See if you can Flash the LED at Different Speeds •See if you can make an SOS signal
biggu
yinab
owtie
.com
![Page 12: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/12.jpg)
@KSUiTeach
Simple CircuitLet’s build a simple circuit now using our Raspberry Pi.
• Connect the Female End to the 3v3 pin and the male end to a row in the breadboard
• Put the LED in the same row splitting both sides of the bread board
• Put one end to the Resistor to the same row as the LED and connect the other end further down the breadboard
biggu
yinab
owtie
.com
![Page 13: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/13.jpg)
@KSUiTeach
Switching CircuitYour Raspberry Pi can act as a switch in the circuit, which can be controlled in software.
• Go through same steps as previous slide EXCEPT:
• Connect the wire in the LED row to a numbered pin
• Take another wire and connect a ground connector with the other end of the resistor
biggu
yinab
owtie
.com
![Page 14: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/14.jpg)
@KSUiTeach
Now to Program with Scratch on the Raspberry Pi
Open Scratch 1.4 and activate the GPIO server.
gpioserveronbig
guyin
abow
tie.co
m
![Page 15: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/15.jpg)
@KSUiTeach
Creating a Blinking LED with Scratch!Setup your pin as an output.
config17out
Switch pin 17 on
gpio17onSwitch pin 17 off
gpio17off
Pause
Loop forever
Always start with:
biggu
yinab
owtie
.com
![Page 16: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/16.jpg)
@KSUiTeach
Python Coding Your LED
#FlashingLED
fromgpiozeroimportLEDfromtimeimportsleep
myled=LED(17)
whileTrue:myled.on()sleep(1)myled.off()sleep(1)
The Code
After coding your LED in Scratch, Code it in Python using the Code below!
biggu
yinab
owtie
.com
![Page 17: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/17.jpg)
@KSUiTeach
Coding Your LED Light Code the Light to Blink. Try some different values!
Try other values in ld.blink(): led.blink(5) led.blink(2, 0.5) led.blink(0.1, 10) led.blink(0.5, 0.5, 5, False)
# Flashing LED
from gpiozero import LED
led = LED(17)
led.blink()
The Code
biggu
yinab
owtie
.com
![Page 18: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/18.jpg)
@KSUiTeach
Other Commands You Can Use
led.on()-SwitchesthePinhigh
led.off()-SwitchesthePinlow
led.blink()-MakestheLEDblink
led.toggle()-ChangethestateoftheLED
led.pin.number-Returnsthepinnumber
led.is_lit-Returnsthecurrentstate
https://gpiozero.readthedocs.org
biggu
yinab
owtie
.com
![Page 19: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/19.jpg)
@KSUiTeach
Challenge 2: Traffic Light
biggu
yinab
owtie
.com
![Page 20: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/20.jpg)
@KSUiTeach
Code Your Raspberry Pi•Find this Slide Deck on the Raspberry Pi Playground at https://
goo.gl/XhMwdC
•Using the next few slides build a Traffic Light, and code it in Python
biggu
yinab
owtie
.com
![Page 21: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/21.jpg)
@KSUiTeach
Hardware ApplicationThere are two ways to build a traffic light
You can get a traffic light add on
You can do it via the Bread Board
biggu
yinab
owtie
.com
![Page 22: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/22.jpg)
@KSUiTeach
Traffic Light Coding
# Traffic Lights 1
from gpiozero import LED
from time import sleep
red = LED(21)
amber = LED(20)
green = LED(16)
red.on()
sleep(3)
red.off()
amber.on()
…
•Use the Code below in order to code the traffic light •Pay special attention to the pins the LED’s are connected to •The Code is not finished, can you finish it The Code
biggu
yinab
owtie
.com
![Page 23: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/23.jpg)
@KSUiTeach
AbstractionYou can removing complexity to make a task more accessible. Give it a TRY!
#TrafficLights1
fromgpiozeroimportLEDfromtimeimportsleep
red=LED(21)amber=LED(20)green=LED(16)
red.on()sleep(3)red.off()amber.on()…
#TrafficLights2
fromgpiozeroimportTrafficLights
fromtimeimportsleep
lights=TrafficLights(21,20,16)
lights.red.on()
sleep(3)
lights.red.off()
lights.amber.on()
…
The Original Code The Less Complex Code
biggu
yinab
owtie
.com
![Page 24: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/24.jpg)
@KSUiTeach
Where next?There are a WHOLE bunch of add ons you can use with the BreadBoard
LED Motion Sensor Buttons
Temp Sensor Motors
Lots More!big
guyin
abow
tie.co
m
![Page 25: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/25.jpg)
@KSUiTeach
Pi Camera Taking Photos
© CC BY-SA 4.0
biggu
yinab
owtie
.com
![Page 26: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/26.jpg)
@KSUiTeach
- 5Mpx / 8Mpx - Full HD - Photo & video - Command line - Python module - Infra-red camera
Raspberry Pi camera module
biggu
yinab
owtie
.com
![Page 27: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/27.jpg)
@KSUiTeach
MaterialsYou will need:
Camera
Female / Female Jumper Wire
BreadBoard
Motion Sensor
Male / Female Jumper Wire
Button
biggu
yinab
owtie
.com
![Page 28: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/28.jpg)
@KSUiTeach
Connect the camera
•Find the Camera Connector
•Pull Up on the Black Tabs
•Push opposite end of Camera Module into connector snuggly and evenly
•Push Down on Black Tabsbiggu
yinab
owtie
.com
![Page 29: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/29.jpg)
@KSUiTeach
Camera CapabilitiesTimelapse High Speed Recording
Sensor & Images Infrared photography
biggu
yinab
owtie
.com
![Page 30: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/30.jpg)
@KSUiTeach
Test your camera•It’s important to test the Camera
to insure you have installed it correctly
•Go to the command line on your Raspberry Pi and type in the commands you have below
pi@raspberrypi:~$raspistill-oimage.jpg
pi@raspberrypi:~$raspistill-k
Ctrl + C to close preview
biggu
yinab
owtie
.com
![Page 31: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/31.jpg)
@KSUiTeach
Challenge 3: Take a Selfie
biggu
yinab
owtie
.com
![Page 32: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/32.jpg)
@KSUiTeach
Code Your Raspberry Pi•Find this Slide Deck on the Raspberry Pi Playground at https://
goo.gl/XhMwdC
•Using the next few slides build a selfie camera, and code it in Python
biggu
yinab
owtie
.com
![Page 33: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/33.jpg)
@KSUiTeach
Take a selfie
##selfie.pyfrompicameraimportPiCamerafromtimeimportsleep
camera=PiCamera()
camera.start_preview(alpha=192)sleep(3)camera.capture("/home/pi/image.jpg")camera.stop_preview()
•Go to Python 3 and enter in the selfie code •Find the Selfie in the File Manager
The Code
biggu
yinab
owtie
.com
![Page 34: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/34.jpg)
@KSUiTeach
Challenge 4: Add a Button
biggu
yinab
owtie
.com
![Page 35: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/35.jpg)
@KSUiTeach
Add a Button•Use your BreadBoard to build a Button for your
Camera
biggu
yinab
owtie
.com
![Page 36: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/36.jpg)
@KSUiTeach
Add Button code
##button.pyfrompicameraimportPiCamerafromgpiozeroimportButtonfromtimeimportsleep
camera=PiCamera()button=Button(17)
camera.start_preview(alpha=192)button.wait_for_press()sleep(3)camera.capture("/home/pi/button.jpg")camera.stop_preview()
Use Python Code to code your camera to take a picture every time you press the button
The Code
biggu
yinab
owtie
.com
![Page 37: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/37.jpg)
@KSUiTeach
Take Multiple Pictures with a Loop
##loop.pyfrompicameraimportPiCamerafromgpiozeroimportButtonfromtimeimportsleep
camera=PiCamera()button=Button(17)
camera.start_preview(alpha=192)foriinrange(5):button.wait_for_press()sleep(1)camera.capture("/home/pi/button{0}.jpg".format(i))camera.stop_preview()
Try out this code as an avenue to take multiple pictures!
The Code
biggu
yinab
owtie
.com
![Page 38: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/38.jpg)
@KSUiTeach
What's the difference?
…
button.wait_for_press()
for i in range(5):
sleep(3)
camera.capture("/home/pi/button{0}.jpg".format(i))
Change your multiple picture code to reflect the code below. What’s the difference?
The Code
biggu
yinab
owtie
.com
![Page 39: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/39.jpg)
@KSUiTeach
Challenge 5: Use Filters
biggu
yinab
owtie
.com
![Page 40: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/40.jpg)
@KSUiTeach
Code Your Raspberry Pi•Find this Slide Deck on the Raspberry Pi Playground at https://
goo.gl/XhMwdC
•Using the next few slides code to take pictures with Filters!
biggu
yinab
owtie
.com
![Page 41: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/41.jpg)
@KSUiTeach
Picamera effectsColor Swap Sketch
Negative Embossbiggu
yinab
owtie
.com
![Page 42: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/42.jpg)
@KSUiTeach
Picamera Effects•Start with the same code from your Selfie
•Use the code below to adjust
•Make sure you save it as an effect
…
camera.start_preview(alpha=192)
button.wait_for_press()
camera.image_effect = 'negative'
sleep(5)
camera.capture("/home/pi/negative.jpg")
camera.stop_preview()
• Try more effects: • negative • colorswap • sketch • emboss
The Code
biggu
yinab
owtie
.com
![Page 43: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/43.jpg)
@KSUiTeach
Challenge 6: Video
biggu
yinab
owtie
.com
![Page 44: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/44.jpg)
@KSUiTeach
Code Your Raspberry Pi•Find this Slide Deck on the Raspberry Pi Playground at https://
goo.gl/XhMwdC
•Using the next few slides code to take Video!
biggu
yinab
owtie
.com
![Page 45: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/45.jpg)
@KSUiTeach
Capturing video
##video.pyfrompicameraimportPiCamera
camera=PiCamera()camera.start_preview(alpha=192)camera.framerate=24camera.start_recording('my_video.h264')camera.wait_recording(15)camera.stop_recording()camera.stop_preview()
pi@raspberrypi:~ $ omxplayer my_video.h264
•Use the code on the left to capture video with the Raspberry Pi •Input the Command Line Code on the Right to Play Your Video The Code
biggu
yinab
owtie
.com
![Page 46: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/46.jpg)
@KSUiTeach
Challenge 7: Add a Motion
Sensorbiggu
yinab
owtie
.com
![Page 47: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/47.jpg)
@KSUiTeach
Code Your Raspberry Pi•Find this Slide Deck on the Raspberry Pi Playground at https://
goo.gl/XhMwdC
•Using the next few slides code to take Video!
biggu
yinab
owtie
.com
![Page 48: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/48.jpg)
@KSUiTeach
Add a Motion Sensor• First thing is first. Hook that Bad Boy Up with your
pins!
• The top of the motion sensor can come off to make it easier to see which cord goes where
biggu
yinab
owtie
.com
![Page 49: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/49.jpg)
@KSUiTeach
Add Motion Sensor Code
##motion.pyfrompicameraimportPiCamerafromgpiozeroimportMotionSensorfromtimeimportsleep
camera=PiCamera()sensor=MotionSensor(4)
camera.start_preview(alpha=192)sensor.wait_for_motion()sleep(3)camera.capture("/home/pi/pir.jpg")camera.stop_preview()
•After connecting the sensor, use the code below to take pictures with motion
The Code
biggu
yinab
owtie
.com
![Page 50: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/50.jpg)
@KSUiTeach
Challenge 8: Time Lapsebig
guyin
abow
tie.co
m
![Page 51: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/51.jpg)
@KSUiTeach
Code Your Raspberry Pi•Find this Slide Deck on the Raspberry Pi Playground at https://
goo.gl/XhMwdC
•Using the next few slides code to create a time lapse!
biggu
yinab
owtie
.com
![Page 52: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/52.jpg)
@KSUiTeach
Capturing a time lapse
##timelapse.pyfrompicameraimportPiCamerafromtimeimportsleep
camera=PiCamera()fornuminrange(1440):
sleep(60)camera.start_preview(alpha=
192)camera.capture("/home/pi/
timelapse{0}.jpg".format(num))camera.stop_preview()
•Use the code below to create a time lapse
The Code
biggu
yinab
owtie
.com
![Page 53: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/53.jpg)
@KSUiTeach
Challenge 9: Create Your Own Projectbig
guyin
abow
tie.co
m
![Page 54: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/54.jpg)
@KSUiTeach
Code Your Raspberry Pi
•Find this Slide Deck on the Raspberry Pi Playground at https://goo.gl/XhMwdC
•Using the next slide to create your own project!
biggu
yinab
owtie
.com
![Page 55: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/55.jpg)
@KSUiTeach
Documentation and help guides
picamera.readthedocs.io
gpiozero.readthedocs.io
raspberrypi.org/resources
raspberrypi.org/education/downloads
biggu
yinab
owtie
.com
![Page 56: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/56.jpg)
@KSUiTeach
Visit: ksuiteach.org Visit: seeedudifferently.com Presentation is at: bigguyinabowtie.com/Google Check out my Youtube Channel! http://bit.ly/bigguybowtievideo Follow me on Twitter, Instagram, and Snapchat @bigguyinabowtie big
guyin
abow
tie.co
m
![Page 57: bigguyinabowtie.combigguyinabowtie · myled = LED(17) while True: myled.on() sleep(1) myled.off() sleep(1) The Code After coding your LED in Scratch, Code it in Python using the Code](https://reader036.vdocuments.us/reader036/viewer/2022081402/5f2b99d3a3b7a576e870523b/html5/thumbnails/57.jpg)
@KSUiTeach
biggu
yinab
owtie
.com