
先準備好一塊樹梅派和SD卡(16G) 首先, 在PC端先下載ImageWriter (win32diskimager-v0.9-binary) 下載官方作業系統Raspbian 2014-01-07-wheezy-raspbian 大概800MB, 解壓縮後約2.9GB




1: function lCOM_Port = getAvailableComPort()
2: % function lCOM_Port = getAvailableComPort()
3: % Return a Cell Array of COM port names available on your computer 4: 5: try
6: s=serial('IMPOSSIBLE_NAME_ON_PORT');fopen(s);
7: catch
8: lErrMsg = lasterr; 9: end 10: 11: %Start of the COM available port12: lIndex1 = findstr(lErrMsg,'COM');
13: %End of COM available port14: lIndex2 = findstr(lErrMsg,'Use')-3;
15: 16: lComStr = lErrMsg(lIndex1:lIndex2); 17: 18: %Parse the resulting string
19: lIndexDot = findstr(lComStr,',');
20: 21: % If no Port are available22: if isempty(lIndex1)
23: lCOM_Port{1}='';
24: return;
25: end 26: 27: % If only one Port is available
28: if isempty(lIndexDot)
29: lCOM_Port{1}=lComStr;30: return;
31: end 32: 33: lCOM_Port{1} = lComStr(1:lIndexDot(1)-1); 34: 35: for i=1:numel(lIndexDot)+1
36: % First One37: if (i==1)
38: lCOM_Port{1,1} = lComStr(1:lIndexDot(i)-1); 39: % Last One 40: elseif (i==numel(lIndexDot)+1) 41: lCOM_Port{i,1} = lComStr(lIndexDot(i-1)+2:end); 42: % Others43: else
44: lCOM_Port{i,1} = lComStr(lIndexDot(i-1)+2:lIndexDot(i)-1); 45: end 46: end 
