Presentation is loading. Please wait.

Presentation is loading. Please wait.

Welcome to Week 4 at the Summer Computer Club Raspberry Pi (contd)

Similar presentations


Presentation on theme: "Welcome to Week 4 at the Summer Computer Club Raspberry Pi (contd)"— Presentation transcript:

1 Welcome to Week 4 at the Summer Computer Club Raspberry Pi (contd)

2 Homework - Week3 Go through Khan Academy https://www.khanacademy.org/science/computer-science/v/introduction-to-programs- data-types-and-variables Binary Numbers Python lists For loops While loops Fun with strings Factorial Program (Simple) Flowchart Two programs: 1. Hello world, printing Hello to all students in the Friends Computer club with as few lines of code as possible 2. Simple Factorial Program that takes a number from user and computes its factorial. 3. Calculator (Holiday week)

3 Electronics in depth Instructional Videos (Watch out for more from Adafruit Videos) A For Ampere B for Battery Circuit Playground Explaining Electrical Circuit

4 Basics Breadboard (http://learn.adafruit.com/lesson-0-getting- started/breadboard)http://learn.adafruit.com/lesson-0-getting- started/breadboard Breadboard is a way of constructing electronics without having to use a soldering iron. Components are pushed into the sockets on the breadboard and then extra 'jumper' wires are used to make connections. LED Light emitting device Resistor Limit current through circuit

5 Your first Pi program to light an LED Step1: Draw a circuit Step2: Map it to the Breadboard. Where is Python in all this? Step3: Use the logic inside your program to act as the battery source

6 Sample program to light an LED

7 Pseudo code to light an LED 1.Import libraries containing functions [import …] 2.Initialize GPIO pins [GPIO.setmode(GPIO.BCM)] 3.Setup LED name and pin [RED_LED=23] 4.Configure LED to be output [GPIO.setup(RED_LED, GPIO.OUT)] 5. Enable pin [GPIO.output(RED_LED,True)]

8 Homework – Week 4 Build a 3 bit binary display using Red, Green, Blue LED’s. Requirements Request user for a number between 0 and 7 (All others should be appropriately rejected) Convert number to 3 bit binary format. Display Most Significant Bit as Red, Middle Bit as Green and Least Significant Bit as Blue. (Ex: Number 5 would convert to Red:On, Green:Off, Blue:On and the number 4 would convert to Red:On, Green:Off, Blue:Off) Three things needed for homework to be complete Circuit Diagram – One is enough, which will be the same for all 3 LED’s. Use resistor of 10K ohms in the diagram. Bread board connectivity diagram. – Ground is on 3H. – Pin 18 (Red LED) is on 6H – Pin 23 (Green LED) is on 8H – Pin 24 (Blue LED) is on 9H – Cobbler spans from Row 1 to Row 15. Python Code to display the LED’s. – Initially as a test use prints to display which LED’s would be on and off.


Download ppt "Welcome to Week 4 at the Summer Computer Club Raspberry Pi (contd)"

Similar presentations


Ads by Google