跳到主要內容

發表文章

小米路由器 mini 中繼模式啟動noip ddns

vi /etc/config/ddns config 'service' 'myddns' option 'service_name' 'noip.com' option 'enabled' '1' option 'domain' 'yourhost.no-ip.org' option 'usernamUe' 'your_username' option 'password' 'your_password' option 'interface' 'wan' option 'ip_source' 'network' option 'ip_network' 'wan' ddnsd start https://wiki.openwrt.org/doc/howto/ddns.client wan 改成區網對外網卡就可以了 一樣可以抓到真實IP

taiko

#include "UsbJoystick.h" #define PIEZOTHRESHOLD 70 #define PADNUM 4 unsigned long time[PADNUM] = {0,0,0,0}; int tempval[PADNUM] = {0,0,0,0}; unsigned long buttontime[PADNUM] = {0,0,0,0}; void setup() {   UsbJoystick.setup(); } void loop() {   UsbJoystick.update();   for(int i = 0; i < PADNUM; i++) {     buttondelay(i);   }   UsbJoystick.sendMsg(); } void buttondelay(int pad){  if ((millis() - buttontime[pad]) > 10) {     int val = analogRead(pad);     if( val >= PIEZOTHRESHOLD ) {       if(tempval[pad]==0){         sendmsg(pad,tempval[pad]);       }       if (val>tempval[pad]){       tempval[pad]=val;       }     }else{       if (tempval[pad]>PIEZOTHRESHOLD){           tempval[pad]=0;       }     }  }else{ ...

XBMC@NextVOD WIFI設定

參考: http://smalldd.pixnet.net/blog/post/18217358-ubuntu-8.04-%E4%BD%BF%E7%94%A8-command-line-%E9%80%A3%E4%B8%8A-wpa2%E5%8A%A0%E5%AF%86-%E7%9A%84-%E7%84%A1%E7%B7%9A http://chinghanyu.twbbs.org/redmine/projects/open-duckbox-project-on-sh4-platform/wiki 手動掛載模組 modprobe /lib/modules/2.6.32.61_stm24_0215/kernel/drivers/net/wireles s/rtl871x/8192cu.ko 新增設定檔 vi /etc/wpa_supplicant.conf 檔案內容 ctrl_interface=/var/run/wpa_supplicant update_config=1 network={    ssid="名稱"    psk="密碼"    proto=RSN    key_mgmt=WPA-PSK    pairwise=TKIP    auth_alg=OPEN } 啟動設定檔 wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf 啟動網路介面 ifup wlan0 開機自動執行 cd /etc/init.d vi rcS 修改 echo "Initializing network interface..." modprobe /lib/modules/2.6.32.61_stm24_0215/kernel/drivers/net/wireless/rtl871x/8 wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf ifconfig eth0 up ifdown wlan0 ifup wlan0 ...

自製 V-USB k-shoot mania controller for Arduino

旋鈕製作 http://mowei-tw.blogspot.tw/2015/06/kshootmania.html V-USB 電路接法參考 http://coopermaa2nd.blogspot.tw/2011/10/v-usb-examples-for-arduino.html D+ , D- 改接成下面 D+ 接腳2 D-  接腳3 按鈕4~10腳 導通到GND觸發 10接腳分 短按 長按 1秒當作分隔 A0,A1一個旋鈕 A2,A3一個旋鈕 程式碼&hex: https://www.dropbox.com/s/j6nek8wpndflp4b/KshootJOY.rar?dl=0 #include "UsbJoystick.h" class rotaryDevice { private: int analogInPin[2]; int newValue[2]; int oldValue[2]; int rotarytrigger; unsigned long rotarytime; public: rotaryDevice(int Pin, int Pin1) { analogInPin[0] = Pin; analogInPin[1] = Pin1; rotarytrigger = 0; rotarytime = 0; oldValue[0] = analogRead(analogInPin[0]); oldValue[1] = analogRead(analogInPin[1]); } int rotaryChanged() { newValue[0] = analogRead(analogInPin[0]); newValue[1] = analogRead(analogInPin[1]); int rotaryresult = rotary(); if (rota...

k-shoot mania 旋鈕 可變電阻製作詳細說明

相關連接~ V-USB k-shoot mania controller for Arduino 這次我使用雙連後抽200K可變電阻(這個雙連後抽手感不太好阿QAQ) 因為上次改造時其中一片互換 另一方向外殼沒挖洞會造成接點夾到外殼 為了省麻煩就直接買雙連後抽  雙連後抽200K可變電阻 接下來進行改造 把紅色圈固定用的東西拆開 從這個方向比較好施工 拆開後比較容易拿尖嘴鉗或剝線鉗進去施工 拿尖嘴鉗或剝線鉗把紅圈地方壓平 並轉轉看會不會被卡到 這樣就完成可變電阻無限旋轉了 再來照電路圖接線 硬體部分OK Arduino 測試程式 const int analogInPin = A0; const int analogInPin1 = A1; void setup() { Serial.begin(9600); } void loop() { Serial.print("val0 = " ); Serial.print(analogRead(analogInPin)); Serial.print("\tval1 = " ); Serial.println(analogRead(analogInPin1)); delay(200); } 旋轉可變電阻(用雙連後抽小心別碰到後面的接點會影響數值) 確定旋轉同一方向 兩邊數值同時上升或同時下降 你會發現 當數值0在往下轉時換變成1019(沒到1023可能是1K歐姆電阻分壓到) 0到最大值中間有出現900以上的數值(不確定產生的原因...) 寫個左轉+1 右轉-1的測試程式 濾掉不可靠的區域 0以下 900以上 當其中一片在此區域時不理會他,採另外一片的數值當參考 沒問題的話就已經成功了~ const int analogInPin = A0; const int analogInPin1 = A1; int newValue[2]={0,0}; int oldValu...

k-shoot mania旋鈕 自製成功!

相關連接~ k-shoot mania 旋鈕 可變電阻製作詳細說明 V-USB k-shoot mania controller for Arduino 這次用雙連可變電阻做實驗 客官看圖~ 開始拆解改裝 再來就是開心的解除封印的時間了呵~ 紅圈就是卡住旋轉的地方 把它弄平就OK了~! 組裝回去其中一片方向改變 然後你會發現其中一個電組怎麼量都是0............. 接點都被外殼夾住了當然怎麼量都是0阿!!! 只好再拆開來貼個絕緣膠帶 轉轉看會不會妨礙選轉 沒問題就改造好了~! 電路長這樣~ 以下隨便接XD 測試程式: const int analogInPin = A0; const int analogInPin1 = A1; int newValue[2]={0,0}; int oldValue[2]={0,0}; int count = 0; void setup() { // initialize serial communications at 9600 bps: Serial.begin(9600); oldValue[0] = analogRead(analogInPin) ; oldValue[1] = analogRead(analogInPin1) ; } void loop() { newValue[0]=analogRead(analogInPin); newValue[1]=analogRead(analogInPin1); rotary(oldValue,newValue); delay(10); } void msg(int outputValue,int outputValue1) { Serial.print(" outputValue: = "); Serial.print(outputValue); Serial.print(" val: = "); Serial.print(" outputValu...

k-shoot mania 旋鈕 第二戰

 題外話...  用寶特瓶做的小馬達固定架!! 大小剛好呢~ 旋鈕也從寶特瓶蓋換成了鋁製旋鈕~ 可是洞好像有點大ˊˇˋ.... 讓我探討可變電阻與小馬達結合的可能性..... 才能塞進特別買的鋁製殼.. 失敗了呢........(哭 以上屍體 1. 為了讓可變電阻有點貢獻 就用可變電阻做做看旋鈕好了 解除封印!! 只要打掉外面凹槽就可以讓可變電阻無限旋轉~!!! 其實裡面在旋轉時有塊塑膠突出物會卡到凹槽,就不能轉了 要馬幹掉塑膠,不然就把凹槽弄掉 然後寫段簡單的程式碼 const int analogInPin = A0; int sensorValue = 0; int oldval = 0; int count = 0; void setup() { Serial.begin(9600); } void loop() { sensorValue = analogRead(analogInPin); int outputValue = map(sensorValue, 0, 1023, 0, 255); int type = oldval - outputValue; if (abs(type) > 240) { oldval = outputValue; if (type < 0) { count++; } else { count--; } Serial.print(" outputValue: = "); Serial.print(outputValue); Serial.print(" val: = "); Serial.println(count); } else if (abs(type) > 5) { oldval = outputValue; if (type > 0) { count++...