by 아발로온v 2015.06.13 19:50
by 아발로온v 2015.06.12 12:58

sudo apt-get -y install libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-progs ffmpeg libavcodec-dev libavcodec53 libavformat53 libavformat-dev libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev libxine1-ffmpeg libxine-dev libxine1-bin libunicap2 libunicap2-dev swig libv4l-0 libv4l-dev python-numpy libpython2.6 python-dev python2.6-dev libgtk2.0-dev

 

 

 

wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.8/opencv-2.4.8.zip/download opencv-2.4.8.zip

 

unzip opencv-2.4.8.zip

cd opencv-2.4.8

mkdir release

cd release

ccmake ../

 

make

sudo make install

by 아발로온v 2015.06.12 03:51
by 아발로온v 2015.06.12 00:52
by 아발로온v 2015.06.12 00:42

ddd

by 아발로온v 2015.06.12 00:08

#!/usr/bin/env python
#
 
import nxt
import sys
import tty, termios
import nxt.locator
from nxt.sensor import *
from nxt.motor import *
 
brick = nxt.locator.find_one_brick()
left = nxt.Motor(brick, PORT_B)
right = nxt.Motor(brick, PORT_C)
both = nxt.SynchronizedMotors(left, right, 0)
leftboth = nxt.SynchronizedMotors(left, right, 100)
rightboth = nxt.SynchronizedMotors(right, left, 100)
 
def getch():
    fd = sys.stdin.fileno()
    old_settings = termios.tcgetattr(fd)
    try:
        tty.setraw(fd)
        ch = sys.stdin.read(1)
    finally:
        termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
    return ch
 
ch = ' '
print "Ready"
while ch != 'q':
    ch = getch()
 
    if ch == 'w':
        print "Forwards"
        both.turn(100, 360, False)
    elif ch == 's':
        print "Backwards"
        both.turn(-100, 360, False)
    elif ch == 'a':
        print "Left"
        leftboth.turn(100, 90, False)
    elif ch == 'd':
        print "Right"
        rightboth.turn(100, 90, False)
 
print "Finished"

by 아발로온v 2015.05.04 16:19

<htmL>
<head>

<title>HoHo Dot Com</title></head>
 

<body><center>
<table border=3 cellpadding=15 width=600>
<tr>
<th colspan=3>
<h2>HoHo's Raspberry Pi Website</h2>
<p align=left style='font:12'>
<tr>
<h2>
<tr>
<th>경 제 분 야<th>산 업 분 야<th>I T 분 야
<tr>
<th colspan=3><h3>오늘의 날씨</h3> ( 동영상 or 사진표시 )
<tr>
<th colspan=3>가입하기 ( 가입시 더많은 정보제공 )
<br>[     ]     [     ]
<br>[     ]     [     ]
<br>[     ]     [     ]
<tr>
<th colspan=3>광고 1 ( 사진 )          광고 2 ( 글 )
</table>
</body>
</htmL>

by 아발로온v 2015.03.25 01:13
by 아발로온v 2015.03.18 13:49

#! game snake


import pygame, sys, time, random
from pygame.locals import *

pygame.init()
fpsClock = pygame.time.Clock()

playSurface = pygame.display.set_mode((640, 480))
pygame.display.set_caption('Raspberry Snake')
redColor = pygame.Color(255,0,0)
blackColor = pygame.Color(0,0,0)
whiteColor = pygame.Color(255,255,255,0)
greyColor = pygame.Color(150,150,150)

snakePosition = [100,100]
snakeSegments = [[100,100],[80,100],[60,100]]
raspberryPosition = [300,300]
raspberrySpawned = 1
direction = 'right'
changeDirection = direction

def gameOver():
    gameOverFont = pygmae.font.Font('freesansbold.ttf',72)
    gameOverSurf = gameOverFont.render('Game Over',True,greyColor)
    gameOverRect = gameOverSurf.get_rect()
    playSurface.blit(gameOverSurf, gameOverRect)
    pygame.display.flip()
    time.sleep(5)
    pygame.quit()
    sys.exit()
   
while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
        elif event.type == KEYDOWN:
            if event.key == K_RIGHT or event.key == ord('d'):
                changeDirection = 'right'
            if event.key == K_LEFT or event.key == ord('a'):
                changeDirection = 'left'
            if event.key == K_UP or event.key == ord('w'):
                changeDirection = 'up'
            if event.key == K_DOWN or event.key == ord('s'):
                changeDirection = 'down'
            if event.key == K_ESCAPE:
                pygame.event.post(pygame.event.Event(QUIT))
       
    if changeDirection == 'right' and not direction == 'left':
        direction = changeDirection
    if changeDirection == 'left' and not direction == 'right':
        direction = changeDirection
    if changeDirection == 'up' and not direction == 'down':
        direction = changeDirection
    if changeDirection == 'down' and not direction == 'up':
        direction = changeDirection
       
    if direction == 'right':
        snakePosition[0] += 20
    if direction == 'left':
        snakePosition[0] -= 20
    if direction == 'up':
        snakePosition[1] -= 20
    if direction == 'down':
        snakePosition[1] += 20

    snakeSegments.insert(0,list(snakePosition))
        
    if snakePosition[0] == raspberryPosition[0] and snakePosition[1] == raspberryPosition[1]:
        raspberrySpawned = 0
    else:
        snakeSegments.pop()
       
    if raspberrySpawned == 0:
        x = random.randrange(1,32)
        y = random.randrange(1,24)
        raspberryPosition = [int(x*20),int(y*20)]
    raspberrySpawned = 1

    playSurface.fill(blackColor)
    for position in snakeSegments:
        pygame.draw.rect(playSurface,whiteColor,Rect(position[0], position[1], 20, 20))
        pygame.draw.rect(playSurface,redColor,Rect(raspberryPosition[0], raspberryPosition[1], 20, 20))
    pygame.display.flip()

    if snakePosition[0] > 620 or snakePosition[0] < 0:
        gameOver()
    if snakePosition[1] > 460 or snakePosition[1] < 0:
        gameOver()

    for snakeBody in snakeSegments[1:]:
        if snakePosition[0] == snakeBody[0] and snakePosition[1] == snakeBody[1]:
            gameOver()

    fpsClock.tick(20)

'공 부  > Raspberry pi b+' 카테고리의 다른 글

리눅스 시리얼통신 예제가 있는 사이트  (0) 2015.03.18
snake game in python  (0) 2015.03.12
by 아발로온v 2015.03.12 11:18
| 1 2 |