2014年10月12日

ntpc U&M安裝s2a

記錄一下在新北市教育作業系統安裝s2a實(scratch2先升級到最新版)
參考文章:http://www.computacaonaescola.ufsc.br/?page_id=503&lang=en
1.安裝python-pip
sudo -s
apt-get update 
apt-get install python-pip
 
2.顯示 pre-installed Python 套件:
pip freeze
 
3.如果沒有出現任何像pyserial==2.5 or pyserial==2.7 在清單中請建立使用 pip, 並安裝 PySerial:
 pip install PySerial
 
4.安裝 PyMata 為了串行通訊在Python 用 Firmata 在 Arduino (PySerial 需要事先安裝 ):
pip install PyMata   
  
5.下載s2a到家目錄
https://github.com/MrYsLab/s2a_fm
 
6.解壓縮,並複製s2a_fm_base_zh_tw.sb2到文件資料夾中

 unzip s2a_fm-master.zip
chmod -R 777  s2a_fm-master
 cp s2a_fm-master/ScratchFiles/ScratchProjects/s2a_fm_base_zh_tw.sb2 ~/Documents/
 chmod 777 ~/Documents/s2a_fm_base_zh_tw.sb2
 
7.開啟終端機
sudo -s

cd ~/cd s2a_fm-master
 python s2a_fm.py /dev/ttyACM0
 
為了避免學生輸入一堆英文字,可以把這一段做成一個sh內容如下
#!/bin/bash 
cd ~/
cd s2a_fm-master
 python s2a_fm.py /dev/ttyUSB0 
 
並做成一個.desktop來執行 

8.看到
s2a_fm version 1.5   Copyright(C) 2013-14 Alan Yorinks    All Rights Reserved 
PyMata version 1.58  Copyright(C) 2013-14 Alan Yorinks    All rights reserved.

Opening Arduino Serial port /dev/ttyACM0 
Please wait while Arduino is being detected. This can take up to 30 seconds ...
Board initialized in 0 seconds
Total Number of Pins Detected = 20
Total Number of Analog Pins Detected = 6
Please wait for Total Arduino Pin Discovery to complete. This can take up to 30 additional seconds.
Arduino Total Pin Discovery completed in 0 seconds
Starting HTTP Server!
Use <Ctrl-C> to exit the extension

Please start Scratch or Snap!
表示連線成功
9.啟動scratch2,並開啟文件資料夾中的s2a_fm_base_zh_tw.sb2
看到 下圖表示連線成功可以運作了。

沒有留言: