outputString="";
targetmac="";
if(readString.indexOf("?")>0)
{
textend = readString.indexOf(" HTTP/1.1");
if((textstart = readString.indexOf("?input=")) >0)
{
textstart+=7;
outputString=readString.substring(textstart,textend);
outputString.toUpperCase();
for(int i=0;i<outputString.length();i=i+2)
{
int temp;
char tempchar=0;
int test=16;
for(int j=0;j<2;j++)
{
if(outputString[i+j]>='A')
{
temp=(int)(outputString[i+j]-'A'+10);
}
else
{
temp=(int)(outputString[i+j]-'0');
}
tempchar+=(char)(temp*test);
test=test/16;
}
targetmac+=tempchar;
}
Udp.beginPacket(broadcast, 7);
for (int i = 0; i < 6; ++i){
Udp.write(0xFF);
}
for(int i=0;i<16;i++)
{
for(int j=0;j<6;j++)
{
Udp.write(targetmac[j]);
}
}
Udp.endPacket();
}
}
2014年6月29日 星期日
Arduino Web Server WOL
1.修改原本的 Web Server 程式碼,並加上UDP 協定 broadcast MagicPacket
2014年6月28日 星期六
Arduino Ethernet Shield 實現家庭自動化
http://www.instructables.com/id/Control-an-LED-over-the-internet-using-the-Arduino/
沿用此程式碼並加以修改
使用Arduino Ethernet Shield 架設WEB SERVER
利用網頁實現
網頁控制LED
Slider調整PWM
監控可變電阻電壓
與一個可自定義控制輸入框
沿用此程式碼並加以修改
使用Arduino Ethernet Shield 架設WEB SERVER
利用網頁實現
網頁控制LED
Slider調整PWM
監控可變電阻電壓
與一個可自定義控制輸入框
2014年6月27日 星期五
Arduino Web Server DECodeURI
1.
架設一個簡單Web Server,以GET方式傳值發現傳入中文字收到的東西變得很不正常
原因是以GET傳值會進行ENCodeURI,如:
架設一個簡單Web Server,以GET方式傳值發現傳入中文字收到的東西變得很不正常
原因是以GET傳值會進行ENCodeURI,如:
http://192.168.137.177/?test=送出
ENCodeURI:
http://192.168.137.177/?test=%E9%80%81%E5%87%BA
2.
而unicode utf-8是一種針對Unicode的可變長度字元編碼
在中文文字使用3byte表示
以”送”的16進位表示為” E9 80 81”
以”出”的16進位表示為” E5 87 BA”
URL編碼會把一個字元以16進制表示轉成兩個字元,然後在其前面放置轉義字元("%"),編碼完後”送”為” %E9%80%81”、"出”為%E5%87%BA。
3.
把’%’去除並把兩個ASCII字元為一組如”E9”,轉換成一個以16進位表示E9一個字元。
ASCII的’A’為65,16進位A為10,ASCII的’0’為48,16進位0為0,
當讀到大寫英文字母進行數字計算以’A’為首減掉’A’的65加10,讀到數字以’0’為首減掉’0’的48即可轉換成16進位表示。
因為兩個字元為一組把先讀到的字元轉成16進位做左移4BIT即乘於16,與下一個字元轉成16進位相加,組合出一個byte存入字串內。
String newstring;
for(int i=0;i<outputString.length();i++)
{
if(outputString[i]=='%')
{
int temp;
char tempchar=0;
int test=16;
for(int j=1;j<3;j++)
{
if(outputString[i+j]>='A')
{
temp=(int)(outputString[i+j]-'A'+10);
}
else
{
temp=(int)(outputString[i+j]-'0');
}
tempchar+=(char)(temp*test);
test=test/16;
}
newstring+=tempchar;
i=i+2;
}
else
{
newstring+=outputString[i];
}
}
2014年6月20日 星期五
Orange's實作結果1.2
1.2
org 07c00h
mov ax,cs
mov ds,ax
mov es,ax
call DispStr
jmp $
DispStr:
mov ax,BootMessage
mov bp,ax
mov cx,16
mov ax,01301h
mov bx,000ch
mov dl,0
int 10h
ret
BootMessage: db "Hello, OS world!"
times 510-($-$$) db 0
dw 0xaa55
2014年6月13日 星期五
kpartx掛載硬碟映像檔
掛載映像檔 kpartx -av ~/hd.img掛載後,就可以在 /dev/mapper/ 目錄下看到兩個loopXpY的文件了。來源:http://www.cnblogs.com/Jer-/p/3330128.html
2014年6月10日 星期二
linaro lubuntu12.04安装vncserver
安装vncserver
apt-get install tightvncserver
第一次启动,生产链接文件 ~/.vnc/xstartup
vncserver :1
vncserver -kill :1
编辑~/.vnc/xstartup
xsession-manger改为startlubuntu &
正式启动vncserver
vncserver -geometry 1280x800 :1
需要开机自启,可以将上述脚本加到/etc/rc.local
來源:http://cubietech.com/forum.php?mod=viewthread&tid=56&highlight=VNC
apt-get install tightvncserver
第一次启动,生产链接文件 ~/.vnc/xstartup
vncserver :1
vncserver -kill :1
编辑~/.vnc/xstartup
xsession-manger改为startlubuntu &
正式启动vncserver
vncserver -geometry 1280x800 :1
需要开机自启,可以将上述脚本加到/etc/rc.local
來源:http://cubietech.com/forum.php?mod=viewthread&tid=56&highlight=VNC
2014年6月9日 星期一
cubieboard nand-part
#get the sunxi-tools and compile up
cd /home
git clone git://github.com/linux-sunxi/sunxi-tools
cd sunxi-tools
#get usb library if not installed, and compile.
apt-get install libusb-1.0-0-dev
make clean
make
1。从SD卡进入CB2
2。查看nand的结构
3。nand-part命令是:
4。再来就是resize2fs
最后检查看:
來源:http://forum.cubietech.com/forum.php?mod=viewthread&tid=1454
http://www.cubieforums.com/index.php?topic=72.0
cd /home
git clone git://github.com/linux-sunxi/sunxi-tools
cd sunxi-tools
#get usb library if not installed, and compile.
apt-get install libusb-1.0-0-dev
make clean
make
1。从SD卡进入CB2
2。查看nand的结构
- root@cubieboard2:~/# ./nand-part -f a20 /dev/nand
- check partition table copy 0: mbr: version 0x00000200, magic softw411
- OK
- check partition table copy 1: mbr: version 0x00000200, magic softw411
- OK
- check partition table copy 2: mbr: version 0x00000200, magic softw411
- OK
- check partition table copy 3: mbr: version 0x00000200, magic softw411
- OK
- mbr: version 0x00000200, magic softw411
- 5 partitions
- partition 1: class = DISK, name = bootloader, partition start = 32768, partition size = 65536 user_type=0
- partition 2: class = DISK, name = env, partition start = 98304, partition size = 32768 user_type=0
- partition 3: class = DISK, name = boot, partition start = 131072, partition size = 65536 user_type=0
- partition 4: class = DISK, name = rootfs, partition start = 196608, partition size = 4194304 user_type=0
- partition 5: class = DISK, name = UDISK, partition start = 4390912, partition size = 3342336 user_type=0
- root@cubieboard2:~/# ./nand-part -f a20 /dev/nand 32768 "bootloader 65536" "env 32768" "boot 65536" "rootfs 7536640"
- root@cubieboard2:~/# fsck -f /dev/nandd
- root@cubieboard2:~/# resize2fs /dev/nandd
- root@cubieboard:~# df -hl
- Filesystem Size Used Avail Use% Mounted on
- /dev/nandd 3.7G 939M 2.6G 27% /
- none 4.0K 0 4.0K 0% /sys/fs/cgroup
- none 91M 180K 91M 1% /run
- none 5.0M 4.0K 5.0M 1% /run/lock
- none 454M 0 454M 0% /run/shm
- none 100M 0 100M 0% /run/user
來源:http://forum.cubietech.com/forum.php?mod=viewthread&tid=1454
http://www.cubieforums.com/index.php?topic=72.0
2014年6月5日 星期四
Cubietruck lubuntu啟動wifi
加載模塊
$modprobe bcmdhd
添加"bcmdhd" 到 /etc/modules
$vi /etc/modules
下載安裝
$apt-get install wifi-radar或者$apt-get install linux-firmware
重啟$reboot
打開wifi
$ifconfig wlan0 up
查找(看)wifi
$iwlist wlan0 scan
來源:http://www.whatled.com/post-1351.html
$modprobe bcmdhd
添加"bcmdhd" 到 /etc/modules
$vi /etc/modules
下載安裝
$apt-get install wifi-radar或者$apt-get install linux-firmware
重啟$reboot
打開wifi
$ifconfig wlan0 up
查找(看)wifi
$iwlist wlan0 scan
來源:http://www.whatled.com/post-1351.html
訂閱:
文章 (Atom)
預測2031/1/1可能 TWCA 憑證 IOS會出現不信任
緣由: TWCA CYBER Root CA 有兩張、兩個效期 (2030、2047年到期) 推測TWCA 預計 2030年12月會停用: TWCA CYBER Root CA (2030 年到期) TWCA Global Root CA 改用啟用: TWCA CYBER ...
-
來源: http://en.miui.com/thread-196713-1-1.html 小蟻智慧攝影機版本: 1.8.5.1l_201511061661(台灣版) 下載檔案 https://drive.google.com/file/d/0ByjBix7wpeJJY0...
-
上次做好沒存檔 這次再翻出來從弄一次...QAQ 花了我一天阿阿阿阿 D+ 接腳2 D- 接腳3 詳情請看usbconfig.h 想改搖桿配置可以用 HID Descriptor Tool 改完記得回usbconfig.h填 USB_CFG...
-
1. 架設一個簡單Web Server,以GET方式傳值發現傳入中文字收到的東西變得很不正常 原因是以GET傳值會進行ENCodeURI, 如 : http://192.168.137.177/?test= 送出 ENCodeURI : http://192....



