+ All Categories
Home > Documents > Surrey Hampshire Hackspace - Akafugu · Surrey Hampshire Hackspace a place to tinker, develop,...

Surrey Hampshire Hackspace - Akafugu · Surrey Hampshire Hackspace a place to tinker, develop,...

Date post: 31-May-2020
Category:
Upload: others
View: 2 times
Download: 0 times
Share this document with a friend
2
0101001101110101011100100111001001100101011110 1001000000100100001100001011011010111000001110 1101101000011010010111001001100101001000000100 0000110000101100011011010110111001101110000011 0001011000110110010100100000011101000110100101 0111001101011011001010111001000100000011001000 1001010111100110010101101100011011110111000000 0000011100110110100001100001011100100110010100 0000001100010011101010110100101101100011001001 Surrey Hampshire Hackspace a place to tinker, develop, hack, create, explore, share,make and collaborate http://sh-hackspace.org.uk http://blog.ricardoarturocabral.com/ http://www.nt7s.com/blog/ import minecraft.minecraft as minecraft import minecraft.block as block mc = minecraft.Minecraft.create() mc.postToChat("Hallo, here's your sphere") radius = 6 playerPos = mc.player.getPos() for x in range(radius*-1,radius): for y in range(radius*-1, radius): for z in range(radius*-1,radius): if x**2 + y**2 + z**2 < radius**2: mc.setBlock(playerPos.x + x, playerPos.y + y + radius, playerPos.z - z - 10, block.GOLD_BLOCK) Draw a Sphere in Minecraft Flash LED using Python import RPi.GPIO as GPIO import time # blinking function def blink(pin): GPIO.output(pin,GPIO.HIGH) time.sleep(1) GPIO.output(pin,GPIO.LOW) time.sleep(1) return # to use Raspberry Pi board pin numbers GPIO.setmode(GPIO.BOARD) # set up GPIO output channel GPIO.setup(11, GPIO.OUT) # blink GPIO17 50 times for i in range(0,50): blink(11) GPIO.cleanup() http://www.rpiblog.com/search/label/GPIO Resistor values for LEDs R = (Supply voltage - LED Voltage Drop) LED Forward Current Examples: LED Resistance = (3.3V - 1.3) 20mA 100 Ohm = LED Resistance = (3.3V - 2.1) 10mA 120 Ohm = Inspired by http://www.doctormonk.com/ 3.3V GND 11 SCLK 9 MISO 10 MOSI 3.3V 22 21 17 GND 4 1 SCL 0 SDA 5V 7 CE1 8 CE0 25 GND 24 23 GND 18 15 RXD 14 TXD GND 5V 2 26 24 22 6 20 18 16 14 12 10 8 4 1 25 23 21 19 17 15 13 11 9 7 5 3 GPIO rev.1 3.3V GND 11 SCLK 9 MISO 10 MOSI 3.3V 22 27 17 GND 4 3 SCL 2 SDA 5V 7 CE1 8 CE0 25 GND 24 23 GND 18 15 RXD 14 TXD GND 5V 2 26 24 22 6 20 18 16 14 12 10 8 4 1 25 23 21 19 17 15 13 11 9 7 5 3 GPIO rev.2 GPIO Overlay (rev.2 has 8 holes next to GPIO) rev 1 rev 2 Useful Links http://www.raspberrypi.org/ - Raspberry Pi website http://sh-hackspace.org.uk/ - Surrey & Hampshire Hackspace http://rlab.org.uk/ - rlab - Reading Hackspace http://learn.adafruit.com/category/raspberry-pi - Adafruit tutorials http://mcpipy.wordpress.com/ - Raspberry Pi Minecraft examples http://bit.ly/GPIOScratch - Scratch controlling GPIO http://scratch.mit.edu - Scratch website http://inventwithpython.com/ - Learn Python by making games http://www.themagpi.com/ - MagPi Magazine Steps to make a desktop computer from default Raspbian install sudo apt-get install gnumeric sudo apt-get install abiword sudo apt-get install gimp sudo apt-get install inkscape sudo apt-get update 1. Make sure Raspbian is up to date 2. Spreadsheet program 3. Wordprocessor 4. Bitmap graphics program 5. Vector graphics program 6. Chrome browser 7. PDF Viewer 8. Audo editor 9. Full Office Suite 10. Kids typing tutor sudo apt-get install chromium-browser sudo apt-get install xpdf sudo apt-get install audacity LibreOffice available in Pi Store sudo apt-get install tuxtype
Transcript
Page 1: Surrey Hampshire Hackspace - Akafugu · Surrey Hampshire Hackspace a place to tinker, develop, hack, create, explore, share,make and collaborate ... 25 GND 24 23 GND 18 15 RXD 14

010100110111010101110010011100100110010101111001001000000100100001100001011011010111000001110011011010000110100101110010011001010010000001001000011000010110001101101011011100110111000001100001011000110110010100100000011101000110100101101110011010110110010101110010001000000110010001100101011110011001010110110001101111011100000010000011100110110100001100001011100100110010100100000011000100111010101101001011011000110010011

SurreyHampshireHackspace

a place to tinker,develop, hack,create, explore,share,make and collaboratehttp://sh-hackspace.org.uk

http://blog.ricardoarturocabral.com/

http://www.nt7s.com/blog/

import minecraft.minecraft as minecraftimport minecraft.block as block

mc = minecraft.Minecraft.create()

mc.postToChat("Hallo, here's your sphere")

radius = 6

playerPos = mc.player.getPos()

for x in range(radius*-1,radius): for y in range(radius*-1, radius): for z in range(radius*-1,radius): if x**2 + y**2 + z**2 < radius**2: mc.setBlock(playerPos.x + x, playerPos.y + y + radius, playerPos.z - z - 10, block.GOLD_BLOCK)

Draw a Sphere in Minecraft

Flash LED using Pythonimport RPi.GPIO as GPIOimport time# blinking functiondef blink(pin): GPIO.output(pin,GPIO.HIGH) time.sleep(1) GPIO.output(pin,GPIO.LOW) time.sleep(1) return# to use Raspberry Pi board pin numbersGPIO.setmode(GPIO.BOARD)# set up GPIO output channelGPIO.setup(11, GPIO.OUT)# blink GPIO17 50 timesfor i in range(0,50): blink(11)GPIO.cleanup() http://www.rpiblog.com/search/label/GPIO

Resistor values for LEDs

R = (Supply voltage - LED Voltage Drop)

LED Forward Current

Examples:

LED Resistance = (3.3V - 1.3)

20mA100 Ohm=

LED Resistance = (3.3V - 2.1)

10mA120 Ohm=

Inspired by http://www.doctormonk.com/

3.3V

GND11 SCLK

9 MISO10 MOSI

3.3V222117

GND4

1 SCL0 SDA

5V

7 CE18 CE025GND2423GND1815 RXD14 TXDGND5V

2

262422

6

2018161412108

41

25232119171513119753

GPIO rev.1

3.3V

GND11 SCLK

9 MISO10 MOSI

3.3V222717

GND4

3 SCL2 SDA

5V

7 CE18 CE025GND2423GND1815 RXD14 TXDGND5V

2

262422

6

2018161412108

41

25232119171513119753

GPIO rev.2

GPIO Overlay (rev.2 has 8 holes next to GPIO)

rev 1

rev 2

Useful Linkshttp://www.raspberrypi.org/ - Raspberry Pi websitehttp://sh-hackspace.org.uk/ - Surrey & Hampshire Hackspacehttp://rlab.org.uk/ - rlab - Reading Hackspacehttp://learn.adafruit.com/category/raspberry-pi - Adafruit tutorialshttp://mcpipy.wordpress.com/ - Raspberry Pi Minecraft exampleshttp://bit.ly/GPIOScratch - Scratch controlling GPIOhttp://scratch.mit.edu - Scratch websitehttp://inventwithpython.com/ - Learn Python by making gameshttp://www.themagpi.com/ - MagPi Magazine

Steps to make a desktop computer from default Raspbian install

sudo apt-get install gnumericsudo apt-get install abiwordsudo apt-get install gimpsudo apt-get install inkscape

sudo apt-get update1. Make sure Raspbian is up to date2. Spreadsheet program3. Wordprocessor4. Bitmap graphics program5. Vector graphics program

6. Chrome browser7. PDF Viewer8. Audo editor9. Full Office Suite10. Kids typing tutor

sudo apt-get install chromium-browsersudo apt-get install xpdfsudo apt-get install audacityLibreOffice available in Pi Storesudo apt-get install tuxtype

Page 2: Surrey Hampshire Hackspace - Akafugu · Surrey Hampshire Hackspace a place to tinker, develop, hack, create, explore, share,make and collaborate ... 25 GND 24 23 GND 18 15 RXD 14

Unix/Linux Command Reference .com

File Commandsls – directory listingls -al – formatted listing with hidden filescd dir - change directory to dircd – change to homepwd – show current directorymkdir dir – create a directory dirrm file – delete filerm -r dir – delete directory dirrm -f file – force remove filerm -rf dir – force remove directory dir *cp file1 file2 – copy file1 to file2cp -r dir1 dir2 – copy dir1 to dir2; create dir2 if it doesn't existmv file1 file2 – rename or move file1 to file2if file2 is an existing directory, moves file1 into directory file2ln -s file link – create symbolic link link to filetouch file – create or update filecat > file – places standard input into filemore file – output the contents of filehead file – output the first 10 lines of filetail file – output the last 10 lines of filetail -f file – output the contents of file as it grows, starting with the last 10 lines

Process Managementps – display your currently active processestop – display all running processeskill pid – kill process id pidkillall proc – kill all processes named proc *bg – lists stopped or background jobs; resume a stopped job in the backgroundfg – brings the most recent job to foregroundfg n – brings job n to the foreground

File Permissionschmod octal file – change the permissions of file to octal, which can be found separately for user, group, and world by adding:

● 4 – read (r)● 2 – write (w)● 1 – execute (x)

Examples:chmod 777 – read, write, execute for allchmod 755 – rwx for owner, rx for group and worldFor more options, see man chmod.

SSHssh user@host – connect to host as userssh -p port user@host – connect to host on port port as userssh-copy-id user@host – add your key to host for user to enable a keyed or passwordless login

Searchinggrep pattern files – search for pattern in filesgrep -r pattern dir – search recursively for pattern in dircommand | grep pattern – search for pattern in the output of commandlocate file – find all instances of file

System Infodate – show the current date and timecal – show this month's calendaruptime – show current uptimew – display who is onlinewhoami – who you are logged in asfinger user – display information about useruname -a – show kernel informationcat /proc/cpuinfo – cpu informationcat /proc/meminfo – memory informationman command – show the manual for commanddf – show disk usagedu – show directory space usagefree – show memory and swap usagewhereis app – show possible locations of appwhich app – show which app will be run by default

Compressiontar cf file.tar files – create a tar named file.tar containing filestar xf file.tar – extract the files from file.tartar czf file.tar.gz files – create a tar with Gzip compressiontar xzf file.tar.gz – extract a tar using Gziptar cjf file.tar.bz2 – create a tar with Bzip2 compressiontar xjf file.tar.bz2 – extract a tar using Bzip2gzip file – compresses file and renames it to file.gzgzip -d file.gz – decompresses file.gz back to file

Networkping host – ping host and output resultswhois domain – get whois information for domaindig domain – get DNS information for domaindig -x host – reverse lookup hostwget file – download filewget -c file – continue a stopped download

InstallationInstall from source:./configuremakemake installdpkg -i pkg.deb – install a package (Debian)rpm -Uvh pkg.rpm – install a package (RPM)

ShortcutsCtrl+C – halts the current commandCtrl+Z – stops the current command, resume with fg in the foreground or bg in the backgroundCtrl+D – log out of current session, similar to exitCtrl+W – erases one word in the current lineCtrl+U – erases the whole lineCtrl+R – type to bring up a recent command!! - repeats the last commandexit – log out of current session

* use with extreme caution.

Provided by Surrey and Hampshire Hackspace at Egham Raspberry Jam April 2013


Recommended