ÉèÖÃLinuxϵͳÒÔÖ§³ÖÎïÁªÍøÓ¦Óÿª·¢
ÉèÖÃlinuxϵͳÒÔÖ§³ÖÎïÁªÍøÓ¦Óÿª·¢
ÎïÁªÍø£¨Internet of Things£¬IoT£©ÊÇÖ¸½«ÎïÀí×°±¸¡¢³µÁ¾ºÍÆäËûÎï¼þǶÈëµç×Ó¡¢´«¸ÐÆ÷¡¢Èí¼þºÍÍøÂçÅþÁ¬£¬´Ó¶øʹÕâЩÎïÌåÄܹ»ÍøÂçºÍ½»Á÷Êý¾Ý¡£ÔÚÎïÁªÍøÓ¦Óÿª·¢Àú³ÌÖУ¬ÉèÖÃLinuxϵͳÒÔÌṩÐëÒªµÄ¿ª·¢ÇéÐκ͹¤¾ßÊDZز»¿ÉÉٵġ£±¾ÎĽ«ÏÈÈÝÔõÑùÉèÖÃlinuxϵͳÒÔÖ§³ÖÎïÁªÍøÓ¦Óÿª·¢£¬²¢ÌṩһЩ´úÂëʾÀý¹©²Î¿¼¡£
Ò»¡¢×°ÖÃLinuxϵͳ
Ê×ÏÈ£¬È·±£ÒѾװÖÃÁËÊʺϵÄLinux²Ù×÷ϵͳ£¬ÈçLubuntu¡¢Ubuntu¡¢DebianµÈ£¬ÒÔ±ãºóÐøµÄ¿ª·¢ºÍÉèÖÃÊÂÇé¡£
¶þ¡¢×°ÖÃÐëÒªµÄ¹¤¾ß
×°ÖñàÒëÆ÷
ÎïÁªÍøÓ¦Óÿª·¢³£Óõıà³ÌÓïÑÔ°üÀ¨C¡¢C++¡¢PythonµÈ£¬ÒÔÊÇÐèҪװÖÃÏìÓ¦µÄ±àÒëÆ÷Ï¢ÕùÊÍÆ÷¡£
×°ÖÃCºÍC++±àÒëÆ÷£º
sudo apt-get update sudo apt-get install build-essential
µÇ¼ºó¸´ÖÆ
×°ÖÃPythonÚ¹ÊÍÆ÷£º
sudo apt-get install python3
µÇ¼ºó¸´ÖÆ
×°Öð汾¿ØÖÆϵͳ
°æ±¾¿ØÖÆϵͳ¿ÉÒÔ×ÊÖú¿ª·¢ÕßÖÎÀí´úÂë°æ±¾£¬³£Óõİ汾¿ØÖÆϵͳ°üÀ¨Git¡¢SVNµÈ¡£
×°ÖÃGit£º
sudo apt-get install git
µÇ¼ºó¸´ÖÆ
×°Öÿª·¢¹¤¾ß
¿ª·¢ÎïÁªÍøÓ¦ÓÃÐèҪʹÓÃһЩ³£ÓõĿª·¢¹¤¾ß£¬ÈçÎı¾±à¼Æ÷¡¢IDEµÈ¡£
×°ÖÃvim±à¼Æ÷£º
sudo apt-get install vim
µÇ¼ºó¸´ÖÆ
×°ÖÃVS Code£º
sudo apt install snapd sudo snap install code --classic
µÇ¼ºó¸´ÖÆ
Èý¡¢ÉèÖÃÍøÂçÇéÐÎ
ÉèÖÃÎÞÏßÍø¿¨
ÎïÁªÍøÓ¦ÓÃͨ³£ÐèÒªÅþÁ¬µ½ÎÞÏßÍøÂ磬ÒÔÊÇÐèÒªÉèÖÃÎÞÏßÍø¿¨¡£
Éó²éÎÞÏßÍø¿¨ÁÐ±í£º
iwconfig
µÇ¼ºó¸´ÖÆ
±à¼/etc/network/interfacesÎļþ£¬Ìí¼ÓÒÔÏÂÄÚÈÝ£º
auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-ssid <wifi_ssid> wpa-psk <wifi_password>
µÇ¼ºó¸´ÖÆ
ÖØÆôÍøÂçЧÀÍ£º
sudo systemctl restart networking
µÇ¼ºó¸´ÖÆ
ÉèÖÃÍøÂçÊðÀí
ÈôÊÇÐèҪͨ¹ýÊðÀíЧÀÍÆ÷ÅþÁ¬ÔÆƽ̨»òÆäËûÍøÂç×ÊÔ´£¬¿ÉÒÔÉèÖÃÍøÂçÊðÀí¡£
±à¼/etc/environmentÎļþ£¬ÔÚ×îºóÌí¼ÓÒÔÏÂÄÚÈÝ£º
http_proxy="http://<proxy_server>:<port>" https_proxy="http://<proxy_server>:<port>"
µÇ¼ºó¸´ÖÆ
ËÄ¡¢×°ÖÃÎïÁªÍø¿ª·¢¿ò¼Ü
ÎïÁªÍøÓ¦Óÿª·¢³£ÓõĿò¼Ü°üÀ¨Node-RED¡¢MosquittoµÈ£¬¿ÉÒÔƾ֤ÐèҪѡÔñºÏÊʵĿò¼Ü¾ÙÐÐ×°Öá£
×°ÖÃNode-RED£º
sudo apt-get install npm sudo npm install -g --unsafe-perm node-red
µÇ¼ºó¸´ÖÆ
×°ÖÃMosquitto£º
sudo apt-get install mosquitto mosquitto-clients
µÇ¼ºó¸´ÖÆ
Îå¡¢´úÂëʾÀý
ÒÔÏÂÊÇÒ»¸ö¼òÆÓµÄPython´úÂëʾÀý£¬ÓÃÓÚ¼àÌýMQTTÐÂÎŲ¢¾ÙÐд¦Öóͷ££º
import paho.mqtt.client as mqtt # ÅþÁ¬Àֳɻص÷º¯Êý def on_connect(client, userdata, flags, rc): print("Connected with result code " + str(rc)) # ¶©ÔÄÖ÷Ìâ client.subscribe("topic/test") # ÐÂÎŻص÷º¯Êý def on_message(client, userdata, msg): print(msg.topic + " " + str(msg.payload)) # ½¨Éè¿Í»§¶ËʵÀý client = mqtt.Client() client.on_connect = on_connect client.on_message = on_message # ÅþÁ¬MQTTÊðÀíЧÀÍÆ÷ client.connect("mqtt.eclipse.org", 1883, 60) # Ñ»·¼àÌýÐÂÎÅ client.loop_forever()
µÇ¼ºó¸´ÖÆ
Áù¡¢×ܽá
±¾ÎÄÏÈÈÝÁËÔõÑùÉèÖÃlinuxϵͳÒÔÖ§³ÖÎïÁªÍøÓ¦Óÿª·¢£¬²¢ÌṩÁËһЩ´úÂëʾÀý¹©²Î¿¼¡£Í¨¹ý׼ȷµÄÉèÖúÍ×°ÖÃÐëÒªµÄ¹¤¾ßºÍ¿ò¼Ü£¬¿ª·¢Õß¿ÉÒÔ¸üÇáËɵؾÙÐÐÎïÁªÍøÓ¦ÓõĿª·¢ÊÂÇ顣ϣÍû±¾ÎĶÔÄãÔÚÎïÁªÍøÓ¦Óÿª·¢ÖÐÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇÉèÖÃLinuxϵͳÒÔÖ§³ÖÎïÁªÍøÓ¦Óÿª·¢µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡