如何给arduino编写库文件
\u5982\u4f55\u7ed9arduino\u7f16\u5199\u5e93\u6587\u4ef6\u4e24\u79cd\u65b9\u6cd5\uff1a \u5728Arduino IDE\u91cc\uff0c\u7b2c\u4e09\u4e2atab-Sketch\u4e0b\u9762-Import library-Add library,\u6307\u5b9a\u5230\u4f60\u7684XXX.zip\u5e93\u6587\u4ef6 \u89e3\u538b\u4f60\u7684zip\u6587\u4ef6\uff0c\u653e\u5230C:\Users\Administrator\Documents\Arduino\libraries\u91cc\u9762\u3002\uff08\u5bf9win7\u7528\u6237\uff0c\u5b9e\u9645\u4e0a\u5c31\u662fwindows\u7528\u6237-\u6211\u7684\u6587\u6863
\u53ef\u4ee5\u8d2d\u4e70\u300aArduino\u7a0b\u5e8f\u8bbe\u8ba1\u57fa\u7840\u300b\u53bb\u5b66\u4e60\u4e0b
两种方法: 在Arduino IDE里,第三个tab-Sketch下面-Import library-Add library,指定到你的XXX.zip库文件 解压你的zip文件,放到C:\Users\Administrator\Documents\Arduino\libraries里面。(对win7用户,实际上就是windows用户-我的文档绛旓細浠g爜妗嗘灦濡備笅锛歷oid setup() { // put your setup code here, to run once://鍒濆鍖栨搷浣滀唬鐮佹斁鍦╯etup鍑芥暟涓紝浠栦滑灏嗗湪绋嬪簭鍚姩鐨勭涓姝ュ緱鍒版墽琛 骞跺彧鎵ц涓娆 } void loop() { // put your main code here, to run repeatedly://灏嗙▼搴忕殑涓昏閫昏緫浠g爜锛屾斁鍦╨oop閲屻備粬浠皢浼氬弽澶嶆墽琛屼笅鍘汇
绛旓細鍒氭帴瑙Arduino鐨勬椂鍊欏氨瑙夊緱瀹夎搴撴枃浠闈炲父鐨勪笉鏂逛究锛屽畨瑁呭畬浠ュ悗蹇呴』閲嶅惎涓涓婣rduino IDE鎵嶈兘澶熸妸搴撳姞杞借繘鏉ャ傚叾瀹濧rduino瀹樻柟鏈潵灏辨湁涓涓潪甯告柟渚跨殑瀹夎搴撶殑鏂规硶
绛旓細缂栬瘧鏃舵槸缂栬瘧杩欎釜鍚堝苟鐨刢pp鏂囦欢銆傚湪鍚屼竴鐩綍涓嬬殑c鍜宑pp鏂囦欢鍗曠嫭缂栬瘧锛岃皟鐢ㄨ繖浜涙枃浠堕氳繃h澶存枃浠讹紝鍗砪/cpp+h銆傜紪璇戞渶鍚庡皢Arduino鏍稿績绋嬪簭銆佸簱鍜屼綘鐨勪唬鐮佸悎骞舵垚elf鏂囦欢銆傛墍浠ヤ綘鍙互灏嗗嚱鏁板畾涔鍐杩沜pp+h锛屽湪ino閲岃皟鐢ㄣ傝鏄痠no澶暱锛屽彲浠ュ啓杩涘緢澶歩no鏂囦欢閲岋紝瀵逛簬Arduino鏉ヨ锛屾渶鍚庨兘鍚堝苟鎴愪竴涓枃浠躲
绛旓細鎺ヤ笅鏉ワ紝浣犻渶瑕佸垱寤轰竴涓柊鐨凙rduino椤圭洰銆備綘鍙互閫氳繃鑿滃崟鏍忎腑鐨"File" -> "New"鏉ュ垱寤轰竴涓柊鐨勯」鐩傚湪鏂扮殑绐楀彛涓紝浣犲彲浠ュ紑濮缂栧啓浣犵殑浠g爜銆傝纭繚浣犲凡缁忓畨瑁呬簡閫傚綋鐨Arduino搴鍜岄┍鍔ㄧ▼搴忥紝骞朵笖浣犵殑鐢佃剳鍜孉rduino鏉胯繛鎺ユ甯搞傜劧鍚庯紝浣犲彲浠ラ氳繃閫夋嫨閫傚綋鐨勫紑鍙戞澘骞朵笂浼犱唬鐮佸埌浣犵殑Arduino鏉夸互杩涜鍒濆缂栫▼...
绛旓細鏁版嵁鏂囦欢涓傜敤鎴峰湪浣跨敤arduino鐨勬椂鍊欙紝鍏跺簱鍑芥暟婧愮爜鏄湪鏁版嵁鏂囦欢涓彲浠ユ壘鍒般Arduino鏄竴濂椾究鎹枫佺伒娲汇佸鏄撲笂鎵嬬殑纭欢寮鍙戝钩鍙帮紝瀹冨寘鎷绉嶅瀷鍙风殑Arduino鎺у埗鐢佃矾鏉匡紝鍜屼笓鐢ㄧ紪绋嬪紑鍙戣蒋浠躲
绛旓細Arduino 搴撴枃浠鍒嗘垚浜 涓夌被銆備竴绫绘槸鏍囧噯鐨勬牳蹇冨簱鍑芥暟锛屽ぇ鑷村湪锛...\Arduino\hardware\arduino\avr 鐩綍閲岋紝鐢盇rduino鏍稿績鍥㈤槦鎻愪緵銆傚彟涓绫昏绉颁箣涓鸿础鐚簱锛屽湪锛...\Arduino\libraries 閲屻 鏄 Arduino 鏍稿績鍥㈤槦鐨勯搧鏉嗙洘鍙嬫彁渚涳紝鐢 Arduino 鏍稿績鍥㈤槦 瀹℃牳纭銆傝繖涓ら儴鍒嗛兘闅 Arduino IDE 涓璧锋崋缁戝彂琛屻...
绛旓細鎶婅繖涓搴撴枃浠鏀惧埌libraries鏂囦欢澶归噷闈㈠氨鍙互浜
绛旓細璇曡瘯鐪嬪鍏ュ叾浠栧簱鑳藉惁姝e父?鏈変簺搴撲細鏀瑰悕瀛, 浠旂粏姣斿涓.鎵嬪伐鎶搴撴枃浠跺す鏀惧埌 C:\Users\your name\Documents\Arduino\libraries 閫鍑虹▼搴忓啀杩愯涓娆
绛旓細Arduino璇█鍦–++鐨勫熀纭涓婅繘琛屼簡涓浜涚畝鍖栧拰灏佽锛屼娇寰楃敤鎴峰彲浠ユ洿鍔犺交鏉惧湴杩涜纭欢缂栫▼銆侫rduino璇█鐨勭紪绋嬫柟寮忕被浼间簬C++锛屽寘鎷彉閲忋佹帶鍒剁粨鏋勩佸嚱鏁扮瓑鍩烘湰璇硶锛屽悓鏃惰繕鏈夎澶氬簱鍑芥暟鍙互鏂逛究鐢ㄦ埛杩涜鍚勭鎿嶄綔锛屽鎺у埗GPIO鍙c佽鍙栦紶鎰熷櫒鏁版嵁銆佽繘琛屼覆鍙i氳绛夈侫rduino璇█鐨勪唬鐮佸彲浠ュ湪Arduino IDE涓缂栧啓鍜岃皟璇曪紝鐒跺悗...
绛旓細纭繚浣犵殑Arduino鏈塂ht11鍜孡iquidCrystal杩欎袱涓簱銆傚鏋滄病鏈夌櫨搴︿笅杞藉畨瑁呬竴涓嬨備綘搴旇浼氬畨瑁匒rduino鐨勫簱鍚э紵绋嬪簭鐨勫墠涓よ include#include鏀规垚 include <dht11.h>#include <LiquidCrystal.h>灏卞彲浠ョ紪璇戜簡銆