FabModules 设置指南

原文:HTML5 FabModules setup tutorial

Fab Modules 可以将不同格式的文件转换成Fab labs常用机器可识别的文件。

这份指南展示如何安装HTML5版本的Fab Modules

Find the modules找到项目地址

你可以在这个地址找到最新版的Fab Modules [https://github.com/fabmodules/fabmodules-html5]

Pre-requisites安装前准备

安装前需要准备以下几个东西

  • git (在终端Terminal使用“apt-get install git”安装命令)

  • wget (如果是debian/system系统,在终端Terminal使用“apt-get install wget”安装命令)

  • node.js & npm (从nodejs.org 下载和安装) Ubuntu系统可以使用 “apt-get install nodejs-legacy npm” 安装命令

  • Python

  • PySerial库. 在Python可以使用后, 在终端Terminal使用“sudo pip install pyserial”安装命令

  • Python TKinter 在终端Terminal使用“sudo apt-get install python-tk”安装命令

Download instructions下载方法

打开终端Terminal,使用cd命令打开到fabmodules下载的地址

比如我的下载和安装地址是/home/fiore/。假如你不是在home目录下,请确保这个文件夹有可写权限

    cd /home/fiore
    git clone https://github.com/FabModules/fabmodules-html5.git fabmodules
    cd fabmodules
    npm install

如果你正确的按照上面的指示进行安装,那么你现在会有一个fabmodules的文件夹包含里面所有的文件。

记得时不时使用git pull将软件更新到最新的稳定版本。

Start Fab Modules Server 开启Fab Modules服务

现在你可以运行mod_serve,确保你使用过上面的npm install命令安装过这个依赖包。

    npm start
    listening for connections from 127.0.0.1 on 12345

你可以安装mod_serve在控制机器的电脑上。然后在Fab Modules界面的server/port类别,用实际端口地址代替127.0.0.1:12345

你也可以在mod_server.js改变主机的默认端口,看看下面两行代码

    var server_port = '12345'
    var client_address = '127.0.0.1'

Changing client_address to 0.0.0.0 will make the server listen for connections coming from any machine in the local network (or the whole internet if the machine has a public ip-address, not recommended). 修改client_address为0.0.0.0将使得服务器监听局域网内所有的机器。(或者使用机器在互联网上的公共IP地址,但是不建议这样做)

You can also change the port to any greater than 1024 (otherwise you must launch mod_serve with sudo, again not recommended). 你也可以改变端口port的值超过1024(否则你必须使用sudo命令登陆mod_serve,不建议这样做)

译者备注:小于1024的Port需要Root权限,参看文章:Linux非root用户程序使用小于1024端口

Using Fab Modules 使用Fab Modules

有很多方法可以使用Fab Modules

Locally from the node web server 本地node网页服务

通过浏览器打开 http://localhost:12345

Using the GitHub server 使用GitHub服务

通过浏览器打开 http://fabmodules.org 使用部署好的版本.

Optional configuration 额外设置

The file mod_settings contains the ports and speeds used for the modules operation. Make sure they match your actual devices. mod_settings文件包含modules操作的端口和速度,确保它匹配你实际的设备。

You can load your mod_settings using the last menu item appearing when you open the index.html page. 当你打开index.html页面,点击菜单选项可以加载你的mod_settings里的设置。

Creative Commons LicenseAll content © 2013 Anna Kaziunas France (except where otherwise noted) Some rights reserved. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License

results matching ""

    No results matching ""