Скачать презентацию Intro to Raspberry Pi Brad Luyster Brad Luyster gmail Скачать презентацию Intro to Raspberry Pi Brad Luyster Brad Luyster gmail

ab2acbea376360a6853b77e01a2ac314.ppt

  • Количество слайдов: 25

Intro to Raspberry Pi Brad Luyster Brad. Luyster@gmail. com Intro to Raspberry Pi Brad Luyster Brad. [email protected] com

Before We Start ● Windows Users – – Navigate to “Raspberry Pi Boot Camp” Before We Start ● Windows Users – – Navigate to “Raspberry Pi Boot Camp” – ● Go to http: //files. lvl 1. org from your web browser Download all the files, then Install Real. Term, Win 32 Disk. Imager and Putty (Keep the. img file for later) Linux/Mac Users – Go to http: //files. lvl 1. org from your web browser – Download “ 2013 -07 -26 -wheezy-raspbian. img” – Install Picocom (Or know how to use screen to open a serial port) – Know how to use “dd” and “ssh”

What is the Raspberry Pi? ! 35 ! $ w Wo What is the Raspberry Pi? ! 35 ! $ w Wo

Raspberry Pi I/O Raspberry Pi I/O

Raspberry Pi I/O http: //elinux. org/RPi_Hardware http: //elinux. org/RPi_Verified. Peripherals http: //elinux. org/Rpi_Low-level_peripherals Raspberry Pi I/O http: //elinux. org/RPi_Hardware http: //elinux. org/RPi_Verified. Peripherals http: //elinux. org/Rpi_Low-level_peripherals

Raspberry Pi I/O Raspberry Pi I/O

Raspberry Pi OS ● Raspberry Pi is a full blown computer ● Runs Linux Raspberry Pi OS ● Raspberry Pi is a full blown computer ● Runs Linux – ● Windows Licensing restrictions make that a nonstarter You're going to learn how to use Linux, yay!

Pi Project Inspiration Pi Project Inspiration

Running your Pi ● Software – Windows ● ● – Linux/Mac ● ● Win Running your Pi ● Software – Windows ● ● – Linux/Mac ● ● Win 32 Disk. Imager Real. Term Picocom Hardware – SD Card – USB Cable – Serial Adapter

Pi OS Choices ● Raspbian ● Arch. Arm ● Pi. Dora Pi OS Choices ● Raspbian ● Arch. Arm ● Pi. Dora

Installing the Image ● Windows – ● Extract Image file to SD Card using Installing the Image ● Windows – ● Extract Image file to SD Card using Win 32 Disk. Imager (Select Image file and SD Drive) Linux – Use “dd bs=4 M if=[IMAGE FILE] of=/dev/sd[DRIVE]” – Be very careful to select the correct “of” drive.

Connect the Serial ● Black to GND ● White to TXD ● Green to Connect the Serial ● Black to GND ● White to TXD ● Green to RXD ● RED IS DISCONNECTED

Logging in to Pi ● Username is “pi” ● Password is “raspberry” ● You Logging in to Pi ● Username is “pi” ● Password is “raspberry” ● You are now at a Linux Console

Linux Console Basics ● “ls”: List files in the current directory ● “cd”: Change Linux Console Basics ● “ls”: List files in the current directory ● “cd”: Change Directory ● “cp”: Copy File ● “mkdir”: Make Directory ● “nano”: Open Text File Editor

Config ● On first boot, run “sudo raspi-config” ● Sudo – Super User Do Config ● On first boot, run “sudo raspi-config” ● Sudo – Super User Do – ● ● Needed to do risky things on Linux Expand Filesystem is the most important thing to do here Reboot Afterward

Hello World! ● Grab and LED, and a 560 ohm Resistor (Green, Blue, Brown) Hello World! ● Grab and LED, and a 560 ohm Resistor (Green, Blue, Brown) ● Resistor to GND ● Short LED leg to resistor ● Long LED leg to #4

Hello World ● ● ● At the console, type “sudo python” and press enter Hello World ● ● ● At the console, type “sudo python” and press enter to open python “import RPi. GPIO as GPIO” to import the GPIO module “GPIO. setmode(GPIO. BCM)” to set board pin numbering ● “GPIO. setup(4, GPIO. OUT)” ● “GPIO. output(4, GPIO. HIGH)” to turn LED on ● “GPIO. output(4, GPIO. LOW)” to turn LED off

More Advanced “Hello World” import RPi. GPIO as GPIO import time GPIO. setmode(GPIO. BCM) More Advanced “Hello World” import RPi. GPIO as GPIO import time GPIO. setmode(GPIO. BCM) GPIO. setup(4, GPIO. OUT) while(1): GPIO. output(4, GPIO. HIGH) time. sleep(1)

Inputs ● ● Put switch in breadboard. Connect 10 k resistor (Brown Black Red) Inputs ● ● Put switch in breadboard. Connect 10 k resistor (Brown Black Red) between 3. 3 v and switch ● Connect other side of switch to GND ● Connect side with resistor to #17

Polled Inputs import RPi. GPIO as GPIO. setmode(GPIO. BCM) GPIO. setup(4, GPIO. OUT) GPIO. Polled Inputs import RPi. GPIO as GPIO. setmode(GPIO. BCM) GPIO. setup(4, GPIO. OUT) GPIO. setup(17, GPIO. IN) while(1): if GPIO. input(17) == GPIO. LOW: GPIO. output(4, GPIO. HIGH)

Interrupt Inputs import RPi. GPIO as GPIO. setmode(GPIO. BCM) GPIO. setup(4, GPIO. OUT) GPIO. Interrupt Inputs import RPi. GPIO as GPIO. setmode(GPIO. BCM) GPIO. setup(4, GPIO. OUT) GPIO. setup(17, GPIO. IN) def my_callback(channel): print("Switch Pressed!")

Debounced Interrupts import RPi. GPIO as GPIO. setmode(GPIO. BCM) GPIO. setup(4, GPIO. OUT) GPIO. Debounced Interrupts import RPi. GPIO as GPIO. setmode(GPIO. BCM) GPIO. setup(4, GPIO. OUT) GPIO. setup(17, GPIO. IN) def my_callback(channel): print("Switch Pressed!")

Networked Pi ● Plug in your network cable ● Type “ifconfig” to get network Networked Pi ● Plug in your network cable ● Type “ifconfig” to get network interface config ● Note the “inet addr” for “eth 0”

Networked Pi ● “sudo apt-get update” ● “sudo apt-get upgrade” ● Upgrades all software Networked Pi ● “sudo apt-get update” ● “sudo apt-get upgrade” ● Upgrades all software packages ● “sudo apt-get install [package]” to install new – Try it now! “sudo apt-get install sl”

Resources ● Buy a Pi – – RS Electronics – ● Element 14 *** Resources ● Buy a Pi – – RS Electronics – ● Element 14 *** MCM Electronics *** Buy Pi Stuff – – ● *** MCM Electronics *** Adafruit Learn – Learn. adafruit. com – Raspberrypi. org – Elinux. org – LVL 1!