跳到主要內容

發表文章

目前顯示的是 6月, 2014的文章

Arduino Web Server WOL

1.修改原本的 Web Server 程式碼,並加上UDP 協定 broadcast MagicPacket 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=

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 Web Server DECodeURI

1. 架設一個簡單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

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

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

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的结构 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 =    6553

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