Development Environments Raspberry Pi ® Saman Amighi 04/2014

Download Report

Transcript Development Environments Raspberry Pi ® Saman Amighi 04/2014

Development Environments
Raspberry Pi ®
Saman Amighi
04/2014
® Raspberry Pi Foundation
Raspberry Pi
Raspberry Pi
Created by the Raspberry Pi Foundation
Built to be an educational tool
Credit Card size computer
Linux Based
Can be powered up with existing power supplies or
batteries
Raspberry Pi
Ports
Key Parts
• USB (1/2)
• Keyboard
• Mouse
• Power (microUSB)
• SD Card
• HDMI or TV Video
• Network/LAN (100)
• Other
• GPIO pins
• Audio Jack
• Status LEDs
Raspberry Pi
General Purpose Input Output (GPIO)
Key Pins
1 – 3.3 V
2–5V
6 – Ground
7 – GPIO4*
13 – GPIO21/27
Raspberry Pi
First steps
Purchase Raspberry Pi
Purchase Components
Create SD card
Boot up initial Image
Login
Next Steps
Decide on a project
Which project do you want to work on?
Electronics – 3 hours - $50
Media Center – 3-5 hours - $30
Linux box with 100% up time – 1 hours - $0
Printer Server (CUPS) – 1 hours - $0
NAS – 3 hours - $100
Laptop (Atrix Lapdock) – 3 hours - $100
Development
Enviroment
Decide on a Development Enviroment
Where?
Work on the Raspberry PI
Work on your own Computer
How?
Which editor to use
Locally - VI, EMACS, NANO, etc.
Remotely - Windows- Notepad, Mac – TextWrangler
Required native SFTP and backups
Development
Environment
(cont’d)
Decide on a Development Environment (cont’d)
Programming Language
C/C++
Python
Shell Scripts (+Cron)
PHP
Etc
Native Compilers/Processors
GCC++
Python
PHP
Non-Native
Language Examples
C/C++
C++ - Compiled Language
case sensitive
Difficult to work with strings
Very specific on variable types
Code
char myString[10];
int iMyInt;
strcpy(myString,”Hello”);
Int myFunction(int ilocalInteger) { return ilocalInteger+1;}
C++ Example
bool
MPU9150::begin(mpu9150_gyr
o_range_t g_rng,
mpu9150_accel_range_t
a_rng,
Language Examples
Python
Python – Interpretive Language
Case sensitive
Indentation heavy (instead of using {} or terminators)
Loose on type definitions ( 1 = “1”)
Can be run interactively
python func1.py OR python and use command line
Print “Hello World”
a=5
mult(a)
Python Example
Command Line
$ python -c 'print "Hello World!"’
Code
import re
for test_string in ['555-1212', 'ILL-EGAL']:
if re.match(r'^\d{3}-\d{4}$', test_string):
print test_string, 'is a valid US local phone number'
else:
print test_string, 'rejected'