2015年4月1日 星期三

jQuery map

http://app.essoduke.org/tinyMap/
https://github.com/essoduke/jQuery-tinyMap

2015年3月30日 星期一

GPS

https://github.com/Knio/pynmea2

import pynmea2
import serial, time
piw = serial.Serial('/dev/ttyAMA0', 9600, timeout=1)
piw.open()
while 1:
        raw = piw.readline()
        if raw.find("GPGGA")==1 :
                msg = pynmea2.parse(raw)
                lat = round((msg.latitude),6)
                lon = round((msg.longitude),6)

                print str(lat)+","+str(lon)

2015年1月6日 星期二

face detation

install simplecv

https://github.com/sightmachine/SimpleCV/blob/develop/doc/HOWTO-Install%20on%20RaspberryPi.rst

install UV4L



出現video 0

範例
https://github.com/leathersole/raspberry-pi-python-sample/blob/master/facesensor/facesensorNoView.py

2015年1月5日 星期一

web server

sudo apt-get install apache2 php5 libapache2-mod-php5

sudo apt-get install mysql-server mysql-client php5-mysql

sudo apt-get install vsftpd



sudo nano /etc/vsftpd.conf

Change anonymous_enable=YES to anonymous_enable=NO, 
Uncomment local_enable=YES 
Uncomment write_enable=YES
then go to the bottom of the file and add force_dot_files=YES


sudo service vsftpd restart

2014年12月9日 星期二

無線網路設定

  • sudo iwlist wlan0 scan | grep SSID
  • sudo apt-get install wpasupplicant
  • sudo vim /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp

wpa-conf /etc/wpa.conf
  • sudo vim /etc/wpa.conf
network={  ssid="bitch"  proto=RSN  key_mgmt=WPA-PSK  pairwise=CCMP TKIP  group=CCMP TKIP  psk="lhucinf305"}

2014年10月30日 星期四

thread

import os
import time
import subprocess
import multiprocessing
import thread

def two(c,a,t):
        st = 'sudo python ./'+c+'.py -a '+a+' '+t
        subprocess.call(st.split())



thread.start_new_thread( two, ("c","12.5", "1", ) )
thread.start_new_thread( two, ("b","12.5", "1", ) )
time.sleep(2)
os.system("sudo python ./c.py -a 7.5 1")
os.system("sudo python ./b.py -a 7.5 1")

2014年10月21日 星期二

Pi Control Servo

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)
GPIO.setup(17, GPIO.OUT)
GPIO.setup(18, GPIO.OUT)

a=GPIO.PWM(4,50)
a.start(5)

b=GPIO.PWM(17,50)
b.start(5)

c=GPIO.PWM(18,50)
c.start(5)

while True:
        #c.ChangeDutyCycle(2.5)
        a.ChangeDutyCycle(3)
        b.ChangeDutyCycle(3)
        c.ChangeDutyCycle(3)
        print'0'
        time.sleep(1)
        a.ChangeDutyCycle(7.5)
        b.ChangeDutyCycle(7.5)
        c.ChangeDutyCycle(7.5)
        print'90'
        time.sleep(1)
        a.ChangeDutyCycle(10)
        b.ChangeDutyCycle(10)
        c.ChangeDutyCycle(10)
        print'180'
        time.sleep(1)