技術文件

所有類型的產品技術文件

Arduino 掃描 I2C 位置查詢

Arduino 掃描 I2C 位置查詢

I²CInter-Integrated Circuit)字面上的意思是積體電路之間,它其實是I²C Bus簡稱,所以中文應該叫積體電路匯流排,它是一種串列通訊匯流排,使用內送流量備援容錯機制從架構,由飛利浦公司在1980年代為了讓主機板、嵌入式系統或手機用以連接低速週邊裝置而發展。I²C的正確讀法為「I平方C」("I-squared-C"),而「I二C」("I-two-C")則是另一種錯誤但被廣泛使用的讀法。

#include <Wire.h>

void setup(){
Wire.begin();
Serial.begin(9600);
Serial.println("\nI2C Scanner");
}
void loop(){
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for (address = 1; address < 127; address++ ){
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0){
Serial.print("I2C device found at address 0x");
if (address < 16)
Serial.print("0");
Serial.print(address, HEX);
Serial.println(" !");
nDevices++;
}else if (error == 4){
Serial.print("Unknow error at address 0x");
if (address < 16)
Serial.print("0");
Serial.println(address, HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(5000); // wait 5 seconds for next scan
}

 

6軸機械手臂組裝教學

所有配件展示(不含舵機和螺絲).

將兩個U型橫梁如圖固定好。

將多功能支架如圖固定在橫樑上方,注意方向,方向錯了下面固定舵機以及其他配件會很麻煩哦。

將舵機裝好舵盤,再安裝在多功能支架上,注意舵機的方向,(下面每個舵機都要先安裝好舵盤,後面就很方便了,由於舵機都是180度的,安裝之前先將舵機旋轉到合適的方向)。

再將一個多功能支架安裝在舵機上。

在多功能支架左邊中間的安裝孔插入M3*10的長螺絲以便安裝軸承。

將舵機如圖安裝好。

如圖將U型支架安裝好,裝好軸承擰上螺母。

在U型支架上繼續安裝一個U型支架。

將一個U型支架和一個L型支架,如圖安裝好。

再安裝一個多功能支架,注意安裝方向哦。

在多功能支架的右邊中間的安裝孔中插入M3*10的長螺絲以便安裝軸承。

如圖安裝好舵機。

如圖將安裝好的支架裝在之前裝好的機械手上,並裝好軸承,擰上螺母。

如圖將兩個多功能支架固定好,注意方向。

在上方的多功能支架上裝好舵機,要注意舵機的方向,並在下面的多功能支架右邊的中間安裝孔中插入M3*10的長螺絲,以便安裝軸承。

如圖將下面的舵機也安裝好,注意舵機的方向,螺絲使用M3*6的短螺絲。

將上面裝好的舵機安裝在之前的機械手上,並裝好軸承,裝上螺母。

將舵盤如圖裝在機械爪子上,擰上M3*6的螺絲(必須是短螺絲哦)。

再如圖安裝好舵機。

將機械爪子安裝好。

安裝好的整體效果。

 

使用 Arduino EEPROM 來儲存變數值

特性: 一般執行 Arduino 時,如果正常供電的狀態下,一些變數會隨著電源消失也會跟著不見了,而 EEPROM 內的資料並不會隨著關機而消失。當我們要儲存用戶密碼或者一些變數值,期待下一次 Arduino 開機後又能讀取到上一次最後運作時的設定,那您就會需要將資料寫入到 EEPROM 內,不會隨著斷電後資料就遺失的問題。 (閱讀全文…)

樹莓派(raspberry)啟用root 帳號

樹莓派使用的linux是debian系統,所以樹莓派啟用root和debian是相同的。

debian裡root帳號默認沒有密碼,但賬帳號鎖定。

當需要root權限時,由默認賬戶經由sudo執行,Raspberry pi 系統中的Raspbian

默認用戶是pi 密碼為raspberry

重新開啟root帳號,可由pi用戶登錄後,在命令行下執行

sudo passwd root

執行此命令後系統會提示輸入兩遍的root密碼,輸入你想設的密碼即可,然後在執行

sudo passwd -- unlock root

這樣就可以解鎖root帳號了。

數莓派 2 安裝 Chrome 瀏覽器與 Google 注音輸入法

樹莓派系統安裝好之後還要裝上一些必須的的工具才能用啊,比如說中文輸入法和瀏覽器。

Ubuntu Mate for Raspberry Pi 2 雖然支持中文,但是是沒有中文輸入法的,於是我們需要自己安裝一個。

我安裝了Google拼音,一個命令就可以裝好fcitx和Google拼音。

sudo apt-get install fcitx fcitx-googlepinyin fcitx-module-cloudpinyin fcitx-sunpinyin

重啟一下就可以使用中文輸入法了。這篇的東西就是在樹莓派上用Google 拼音敲出來的:)


系統自帶的是FireFox,用起來也還挺流暢,但是我個人習慣用Chrome,於是我安裝了Chromium瀏覽器。
Ubuntu Mate自帶的源里是沒有Chromium的,於是我們要先添加一個源,用以下命令。

sudo tee /etc/apt/sources.list.d/i386.list
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi 
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
deb http://mirrors.neusoft.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
deb-src http://mirrors.neusoft.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
deb-src http://mirrors.ustc.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi

THIS IS THE ONLY WAY TO GET CHROMIUM ON JESSIE!
THIS WILL ONLY WORK ON A Pi2!

1. Install and configure Raspbian. There are plenty of guides on how to do this.

THIS HAS BEEN UPDATED FOR JESSIE. SORRY, BUT NO WHEEZY INSTRUCTIONS. JESSIE IS THE FUTURE.;) 
2. Download and install updated Chromium and dependencies:
For anyone who doesn't trust me, these are the same exact files gotten from here:
http://ports.ubuntu.com/pool/universe/c/chromium-browser/
If you feel more secure getting the relative files there, by all means. But those files may disappear at any time, which is why I host them on my DropBox. 
CODE: SELECT ALL
wget https://dl.dropboxusercontent.com/u/87113035/chromium-browser-l10n_45.0.2454.85-0ubuntu0.15.04.1.1181_all.deb
wget https://dl.dropboxusercontent.com/u/87113035/chromium-browser_45.0.2454.85-0ubuntu0.15.04.1.1181_armhf.deb
wget https://dl.dropboxusercontent.com/u/87113035/chromium-codecs-ffmpeg-extra_45.0.2454.85-0ubuntu0.15.04.1.1181_armhf.deb
sudo dpkg -i chromium-codecs-ffmpeg-extra_45.0.2454.85-0ubuntu0.15.04.1.1181_armhf.deb
sudo dpkg -i chromium-browser-l10n_45.0.2454.85-0ubuntu0.15.04.1.1181_all.deb chromium-browser_45.0.2454.85-0ubuntu0.15.04.1.1181_armhf.deb


You should have Chromium 45 now installed!

 
台灣物聯科技 TaiwanIOT