OpenWrt relayd

开始前,电脑使用网线连接MR10U的LAN/WAN网线接口,tenlet 192.168.1.1进入设置

开启WIFI功能,MR10U刷OpenWrt默认没启用WIFI

uci set wireless.@wifi-device[0].disabled=0
uci commit wireless
wifi

创建wwan接口

uci set network.wwan=interface
uci set network.wwan.proto=dhcp
uci commit network

连接上级路由,我的上级路由是WR720N,OpenWrt系统

uci set wireless.radio0.channel=11	#与上级路由使用同样的通道
uci set wireless.@wifi-iface[0].network=wwan
uci set wireless.@wifi-iface[0].mode=sta
uci set wireless.@wifi-iface[0].ssid=OpenWrt 	# 上级路由SSID
uci set wireless.@wifi-iface[0].encryption=psk2	# 上级路由加密方式
uci set wireless.@wifi-iface[0].key=12345678	# 上级路由密码
uci commit wireless
wifi down
wifi

ifconfig查看wlan0是否连接成功,成功后还不能上网需要设置一下网关与DNS

uci set network.lan.ipaddr=192.168.2.1 		# 修改本路由的IP,避免与上级路由冲突
uci set network.lan.gateway=192.168.1.1 	# 上级路由网关
uci set network.lan.dns=8.8.8.8 			# 不要使用上级路由IP
uci commit network
wifi down
wifi

修改路由IP后需要使用新IP进行连接 telnet 192.168.2.1

安装relayd,能上网以后

opkg update
opkg install relayd
/etc/init.d/relayd enable

创建stabridge接口

uci set network.stabridge=interface
uci set network.stabridge.proto=relay
uci set network.stabridge.network="lan wwan"
uci commit network

禁用本地DHCP服务器

uci set dhcp.lan.ignore=1
uci commit dhcp

调整防火墙

uci set firewall.@zone[0].forward=ACCEPT
uci set firewall.@zone[0].network="lan wwan"
uci commit firewall

创建无线中继,通过无线接入MR10U上网

uci set wireless.@wifi-iface[1].device=radio0
uci set wireless.@wifi-iface[1].network=lan
uci set wireless.@wifi-iface[1].mode=ap
uci set wireless.@wifi-iface[1].ssid=MR10U
uci set wireless.@wifi-iface[1].encryption=psk2
uci set wireless.@wifi-iface[1].key=12345678
uci commit wireless
/etc/init.d/dnsmasq restart
/etc/init.d/firewall restart
wifi down
wifi

完成!

unity

正方体的平移旋转

创建一个正方体,编写js脚本赋予正方体

function Update () {
	transform.Translate(Vector3.left * Time.deltaTime);		// 向左移动
	transform.Rotate(Vector3.right * 2);					// 向右旋转
}

xctool

$ sudo apt-get update
$ sudo apt-get install build-essential cmake git telnet
$ git clone http://git.eclipse.org/gitroot/mihini/org.eclipse.mihini.git mihini-repo	
$ cd mihini-repo
$ ./bin/build.sh
$ cd build.default/
$ make lua
$ make modbus_serial
$ make gpio 
$ mv runtime ~/mihini
$ cd ~/mihini
$ vim lua/agent/platform.lua
-- 修改成
function M.getdeviceid()
    local io = require "io"
    local string = require "string"
    local deviceId
    for line in io.lines('/proc/cpuinfo') do
        if string.find(line, 'Serial') then
            deviceId = string.sub(line, 11)
            break
        end
    end
    log("agent.platform", "INFO", "getdeviceid: deviceId set [%s]", deviceId);
    return deviceId
end
$ cd /etc/ld.so.conf.d/
$ sudo /bin/sh -c 'echo "/home/pi/mihini/lib/" > 01-mihini.conf'
$ sudo ldconfig
$ ./start.sh

创建hello,然后是重要的一步,修改Ssh Lua节点中的Properties中的Lua CPath为

/home/pi/mihini/lua/?.so

Lua Path为

/home/pi/mihini/lua/?.lua;/home/pi/mihini/lua/?/init.lua;?.lua

然后就可以启动了

参考:http://wiki.eclipse.org/Mihini/Build_Mihini

参考:http://wiki.eclipse.org/Mihini/Run_Mihini_on_an_Open_Hardware_platform

Learning Python3

xctool

安装

$ brew install xctool	

build

build后的包在DerivedData对应的目录里

$ xtool -workspace xxx.xcworkspace -scheme xxx build

archive

archive后的包在Archives对应的目录里

$ xtool -workspace xxx.xcworkspace -scheme xxx archive