Presentation on theme: "V2013.14. 2 Avon High School Tech Club Agenda Old Business –Executive Committee –LCCUG meeting volunteer(s) –Reward Points Program New Business –Weekly."— Presentation transcript:
2 Avon High School Tech Club Agenda Old Business –Executive Committee –LCCUG meeting volunteer(s) –Reward Points Program New Business –Weekly Quiz –Updated Website Raspberry Pi Sensor Project –Intro to Python –LED
3 Avon High School Tech Club Executive Committee President –Name Vice President –Name Communications Director –Name Treasurer –Name Term begins next school year
4 Avon High School Tech Club Lorain County Computer User Group Website: Established around 1990 The majority of their members are retired Have a variety of knowledge and skills June 10 th Meeting: 6:00 – 7:30PM Present on a topic of our choice Volunteers?
5 Avon High School Tech Club Avon Library Explorers Program June 24 th at the Avon Public Library –Mini Explorers (Pre K - Kindergarten) 12:30-1:30 PM –Explorers (1 st - 5 th Grade) 2:00 -3:00 PM Theme is “Fun with Robotics” Game/activity/experiment that will be engaging, but not too advanced for respective age groups Any kid-friendly games or activities that we want to develop would be perfect No longer needed
6 Avon High School Tech Club Weekly Quiz What command should you use to immediately & gracefully shutdown and halt the Raspberry Pi? – sudo shutdown –h now What command would you use to find the amount of free memory? – free -h Which command shows a list of commands you recently typed? – history What command would you use to reconfigure the Raspberry Pi? – sudo raspi-config What Raspberry Pi feature will we use to communicate with off- board sensors? –GPIO No perfect scores!
7 Avon High School Tech Club Reward Points Program Earn reward points for: –Completing surveys, polls, etc. –Completing weekly tasks –Completing projects –Participate during meetings –Volunteer opportunities Redeem points for: –Tech Club gear –Other prizes Create reward levels
8 Avon High School Tech Club Raspberry Pi Sensor Project Goals for today: –Editors –Intro to Python –Connect LED
9 Avon High School Tech Club Getting Started: Editors nano IDLE Geany
10 Avon High School Tech Club Our First Python Program Create the hellopi.py file using nano as follows: nano -c hellopi.py Within our hellopi.py file, add the following code: #!/usr/bin/python #hellopi.py print ("Hello Raspberry Pi") When done, save and exit (Ctrl + X, Y, and Enter) To run the file, use the following command: python hellopi.py
11 Avon High School Tech Club Challenges for Reward Points Change “Hello Raspberry Pi” text to red Show CPU speed or Temperature Add ‘LED on/LED off’ to blink code Have the on/off message coincide with LED See website code samples for guidance
12 Avon High School Tech Club Using GPIO: Raspberry Pi Pinout
13 Avon High School Tech Club Using GPIO: Power a LED 1.Resistor connects between Ground and LED cathode (short lead) 2.Connect jumper from 3.3v to LED anode (long lead) 3.Connect black wire to Ground, pin 6 4.Connect red wire to 3.3v, pin 1
14 Avon High School Tech Club Using GPIO: Code to Blink LED #!/usr/bin/env python # Must be run as root: sudo python blink11led.py # Import necessary modules # Provides various time-related functions import time # Control Raspberry Pi GPIO channels import RPi.GPIO as GPIO
15 Avon High School Tech Club Using GPIO: Code to Blink LED # Blinking function, turns LED on/off def blink(pin): # Turn LED on GPIO.output(pin, GPIO.HIGH) # Pause for 1 second time.sleep(1) # Turn LED off GPIO.output(pin, GPIO.LOW) # Pause for 1 second time.sleep(1) return
16 Avon High School Tech Club Using GPIO: Code to Blink LED # Use Raspberry Pi board pin numbers GPIO.setmode(GPIO.BOARD) # Set the output channel/pin GPIO.setup(11, GPIO.OUT) # Blink LED 10 times for i in range(0,10): blink(11) # Reset any GPIO pins when you exit the program GPIO.cleanup()
17 Avon High School Tech Club Using GPIO: Blinking LED 1.Remove red wire 2.Connect yellow wire from pin 11 to anode of LED (long lead)
18 Avon High School Tech Club More Python Fun Code samples: –Add colors to terminal –Get system information See our webpage under ‘Raspberry Pi Workshop’ –Look for ‘additional Python examples to try!’
Avon High School Tech Club 19 Backup Slides
20 Avon High School Tech Club How do Python Programs Run?