Download presentation
Presentation is loading. Please wait.
Published byKristian Ellis Modified over 9 years ago
1
Development Environments Raspberry Pi ® Saman Amighi 04/2014 ® Raspberry Pi Foundation
2
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
3
Raspberry Pi Key Parts Ports USB (1/2) Keyboard Mouse Power (microUSB) SD Card HDMI or TV Video Network/LAN (100) Other GPIO pins Audio Jack Status LEDs
4
Raspberry Pi General Purpose Input Output (GPIO) Key Pins 1 – 3.3 V 2 – 5 V 6 – Ground 7 – GPIO4* 13 – GPIO21/27
5
Raspberry Pi First steps Purchase Raspberry Pi Purchase Components Create SD card Boot up initial Image Login
6
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
7
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
8
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 Ino/Arduino Ruby
9
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;}
10
C++ Example bool MPU9150::begin(mpu9150_gyr o_range_t g_rng, mpu9150_accel_range_t a_rng, byte addr) { Wire.begin(); address_ = addr; // Make sure the correct device is actually connected if (read8(MPU9150_WHO_AM_I) != MPU9150_ID) { return false; } // Set the gyro range write8((byte)MPU9150_GYRO _CONFIG, (byte)g_rng << 3); // Set the accel range write8((byte)MPU9150_ACCEL _CONFIG, (byte)a_rng << 3); // Set the clock source and take the device out of sleep mode write8((byte)MPU9150_PWR_ MGMT_1, 0x02); return true; }
11
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)
12
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'
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.