發表文章

目前顯示的是有「raspberry pi」標籤的文章

Raspberry Pi 樹莓派做 BT 盒子教學-使用Deluged

圖片
用電腦遠端的方式叫樹梅派下載,由於新版的樹梅派作業系統raspbian 2017~2018.4期間的檔案用網頁下載不下來,每次下載都要5個小時以上,而且載到一半就失敗,這問題困擾了我很久,因為買新版的板子無法用舊版的raspbian,之後看到有人用這方式下載檔案,樹梅派官網也有提供BT種子,我就想說那就試試看吧!不然我也找不到有人丟檔案在網路上,都是丟官網連結。 這個方式是用樹梅派下載,所以可以將自己的PC關機他還是會繼續下載,而且功率消耗更低,可以做長期下載資料用。這是我覺得還蠻簡單的方法。 一、raspberry pi install deluged step: 1.先確認軟件到最新版 sudo apt-get update sudo apt-get upgrade 2.再來要查詢外接的 隨身碟 或 外接硬碟 是否有讀到 sudo fdisk -l 本來我看的教學是有掛載USB driver,我最後因為某些原因弄掉了   因為我搞到樹梅派當掉,硬拔電源,結果開不了機,最後把掛載的刪掉才重回新生 3.在USB裡建立你下載後儲存的資料夾 4.接下來就要安裝 Deluged sudo apt-get install deluged sudo apt-get install deluge-console 啟動測試看看 deluged 5.接下來要設定使用者 先將程式停掉,才能修改 sudo pkill deluged 保險一點先做備份 sudo cp ~/.config/deluge/auth ~/.config/deluge/auth.old 打開文件 sudo nano ~/.config/deluge/auth 在新的一行加入使用者 abc:1234:10        //用戶名稱:密碼:權限(10是最高) 6.啟動deluged deluged deluge-console 進入console config -s allow_remote True config allow_remote exit  //離開 二、PC deluged software install 1.安裝軟體 搜尋deluged找到你適合的作業系統安裝就好 2.進入設定se...

raspberrypi 開機自動執行程式 與 在terminal開啟第二個terminal執行python

raspberrypi 開啟另一個terminal執行程式 在terminal輸入: lxterminal -e python3 demo.py 參考自: https://www.raspberrypi.org/forums/viewtopic.php?t=65607 ------------------------------------------------------------------------------------------------------------------------------------------------------- raspberrypi 開機自動執行程式 在terminal中輸入以下指令,開啟檔案: sudo nano /etc/rc.local 以下是加入執行python程式 #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. # Print the IP address _IP=$(hostname -I) || true if [ "$_IP" ]; then    printf "My IP address is %s\n" "$_IP" fi sudo python /home/pi/demo.py  <==加入在這邊 exit 0 參考自: http://dirtypig8.blogspot.tw/2016/12/python.html#!/tcmbck

raspberry pi 3 上安裝 python的pyalsaaudio 來控制音量

圖片
目前我安裝pyalsaaudio的目的,是要用程式的方式控制rpi3上音量的大小 但在安裝過程中遇到一些瓶頸,因為我用的是python3,在這裡紀錄遇到的情形,及是如何解決的。 安裝 一開始輸入 sudo pip3 install pyalsaaudio 出現以下錯誤 pi@raspberrypi:~ $ sudo pip3 install pyalsaaudio Downloading/unpacking pyalsaaudio   Downloading pyalsaaudio-0.8.4.tar.gz (315kB): 315kB downloaded   Running setup.py (path:/tmp/pip-build-150927bh/pyalsaaudio/setup.py) egg_info for package pyalsaaudio         warning: no files found matching '*.json' under directory 'doc' Installing collected packages: pyalsaaudio   Running setup.py install for pyalsaaudio     building 'alsaaudio' extension     arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c alsaaudio.c -o build/temp.linux-armv7l-3.4/alsaaudio.o     alsaaudio.c:28:28: fatal error: alsa/asoundlib.h: 沒有此一檔案或目錄      #inc...

python pyautogui 簡介

pyautogui 是 python的一個模組,他能控制鍵盤和滑鼠的操作,能利用它做自動化操作,像是用在軟體測試、重複性動作等。 pyautogui 暫停幾秒鐘 >>>pyautogui.PAUSE = 1.5 fail-safe (預設false) 當滑鼠一道螢幕左上角時,觸發 pyautogui 的failsafeexception 異常 >>>pyautogui.FAILSAFE = True 螢幕上的座標軸 (0,0) →→→→(1920,0)    ↓    ↓    ↓    ↓ (0,1080) 取得螢幕解析度 >>>import pyautogui >>>pyautogui.size() (1920, 1080) >>>width, height = pyautogui.size() 滑鼠部分 moveTo(width, height, duration) example移動到(300, 400)位置 pyautogui.moveTo(300, 400)                 #立即到 pyautogui.moveTo(300, 400, duration = 1.5) #花1.5秒移到 moeRel(width, height, duration) 移到相對座標,以當前滑鼠座標為基準點 pyautogui.moveRel(0, 100, duration=0.25) pyautogui.moveRel(-100, 0, duration=0.25) position() 獲得滑鼠當前的座標位置 >>>pyautogui.position() (300, 400) click(width, height, button) 滑鼠點擊 button = 'left', 'middle', 'right'。 pyautogui.click()       ...

raspberry pi 3 安裝python pyautogui

圖片
主要安裝步驟 linux 需安裝其他的東西 sudo apt-get install python-tk sudo apt-get install python3-dev sudo apt-get install scrot sudo pip3 install python3-xlib 最後安裝 sudo pip3 install pyautogui 新版的應該是已安裝好以下: python-tk python3-dev scrot 錯誤一 如果直接安裝pyautogui會出現以下的錯誤 表示缺少xlib 只要安裝 python3-xlib完,再安裝pyautogui就可以了 錯誤二 如果像我其他都安裝好了,但是pyautogui還是安裝不成功,出現以下錯誤 那就把 sudo pip3 install pyautogui 改成 sudo xvfb-run pip3 install pyautogui 上網查 xvfb-run 應該是模擬安裝的意思 pi@raspberrypi:~ $ sudo pip3 install pyautogui Downloading/unpacking pyautogui Downloading PyAutoGUI-0.9.36.tar.gz (46kB): 46kB downloaded Running setup.py (path:/tmp/pip-build-0mnn6hrh/pyautogui/setup.py) egg_info for package pyautogui Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/Xlib/xauth.py", line 43, in __init__ raw = open(filename, 'rb').read() FileNotFoundError: [Errno 2] No such file or directory: '/root/.Xauthority' During handling ...