×ðÁú¿­Ê±

ÉèÖÃLinuxϵͳÒÔÖ§³ÖÖÇ»ÛÅ©ÒµºÍÅ©ÒµÎïÁªÍø¿ª·¢

ÉèÖÃlinuxϵͳÒÔÖ§³ÖÖÇ»ÛÅ©ÒµºÍÅ©ÒµÎïÁªÍø¿ª·¢

ÖÇ»ÛÅ©ÒµºÍÅ©ÒµÎïÁªÍøµÄÉú³¤ÕýÔÚÍƶ¯Å©ÒµÉú²ú·½·¨µÄˢкÍÓÅ»¯¡£×÷ΪһÖÖ¿ªÔ´²Ù×÷ϵͳ£¬LinuxÔÚÕâ¸öÁìÓòÖÐÊÎÑÝ×ÅÖ÷ÒªµÄ½ÇÉ«¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚLinuxϵͳÉϾÙÐÐÉèÖã¬ÒÔÖ§³ÖÖÇ»ÛÅ©ÒµºÍÅ©ÒµÎïÁªÍøµÄ¿ª·¢£¬²¢ÌṩһЩ´úÂëʾÀý¡£

Ò»¡¢×°ÖÃLinuxϵͳ

Ê×ÏÈ£¬ÎÒÃÇÐèҪװÖÃLinux²Ù×÷ϵͳ¡£LinuxÓÐÐí¶à²î±ðµÄ¿¯Ðаæ¿É¹©Ñ¡Ôñ£¬ºÃ±ÈUbuntu¡¢CentOSµÈ¡£Ñ¡ÔñÊʺÏ×Ô¼ºµÄ¿¯Ðа棬ƾ֤¹Ù·½Îĵµ¾ÙÐÐ×°Öü´¿É¡£

¶þ¡¢×°ÖÃÐëÒªµÄ¿ª·¢¹¤¾ß

×°ÖÃGCC

GCCÊÇLinuxϵͳÉÏ×î³£ÓõıàÒëÆ÷Ì×¼þÖ®Ò»£¬¿ÉÒÔ±àÒëCºÍC++³ÌÐò¡£ÔÚÖÕ¶ËÖÐÊäÈëÒÔÏÂÏÂÁî×°ÖÃGCC£º

sudo apt-get install gcc

×°ÖÃPython

PythonÊÇÒ»ÖÖ³£Óõıà³ÌÓïÑÔ£¬ÔÚÅ©ÒµÎïÁªÍø¿ª·¢ÖÐÒ²±»ÆÕ±éʹÓá£ÔÚÖÕ¶ËÖÐÊäÈëÒÔÏÂÏÂÁî×°ÖÃPython£º

sudo apt-get install python

×°ÖÃArduino IDE

ÈôÊÇÄãʹÓÃArduinoÀ´¿ª·¢Å©ÒµÎïÁªÍø×°±¸£¬ÄÇôÄãÐèҪװÖÃArduino IDE¡£ÔÚÖÕ¶ËÖÐÊäÈëÒÔÏÂÏÂÁî×°ÖÃArduino IDE£º

sudo apt-get install arduino

Èý¡¢ÉèÖô®¿ÚͨѶ

Å©ÒµÎïÁªÍø×°±¸Í¨³£Ê¹Óô®¿ÚÓëÅÌËã»ú¾ÙÐÐͨѶ¡£ÔÚLinuxϵͳÉÏ£¬´®¿Ú×°±¸µÄ·¾¶Í¨³£Îª/dev/ttyUSB0¡£ÔÚÖÕ¶ËÖÐÊäÈëÒÔÏÂÏÂÁĿ½ñÓû§Ìí¼Óµ½dialout×飬ÒÔ±ãÓµÓжԴ®¿Ú×°±¸µÄ»á¼ûȨÏÞ£º

sudo usermod -a -G dialout $USER

×¢Ïú²¢ÖØеǼºó£¬Äã¾Í¿ÉÒÔͨ¹ý´®¿ÚÓëÅ©ÒµÎïÁªÍø×°±¸¾ÙÐÐͨѶÁË¡£

ËÄ¡¢ÉèÖÿª·¢ÇéÐÎ

ÉèÖÃArduino¿ª·¢ÇéÐÎ

·­¿ªArduino IDE£¬ÔÚ”¹¤¾ß”²Ëµ¥ÖÐÑ¡Ôñ”°å×Ó”£¬È»ºóÑ¡ÔñÄãʹÓõÄArduino°å×ÓÀàÐÍ¡£½ÓÏÂÀ´£¬Ñ¡Ôñ´®¿Ú×°±¸Â·¾¶£¬ÔÚ”¹¤¾ß”²Ëµ¥ÖÐÑ¡Ôñ”´®¿Ú”£¬È»ºóÑ¡Ôñ/dev/ttyUSB0»òÄãÄ¿½ñʹÓõĴ®¿Ú×°±¸Â·¾¶¡£

ÉèÖÃPython¿ª·¢ÇéÐÎ

ÔÚʹÓÃPython¾ÙÐÐÅ©ÒµÎïÁªÍø¿ª·¢Ê±£¬³£ÓõĿâÓÐpaho-mqttºÍrequests¡£Äã¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî×°ÖÃÕâÁ½¸ö¿â£º

sudo pip install paho-mqtt requests

ÔÚÄãµÄPython´úÂëÖУ¬¿ÉÒÔʹÓÃpaho-mqtt¿âÀ´ÊµÏÖÓëMQTTЧÀÍÆ÷µÄͨѶ£¬Ê¹ÓÃrequests¿âÀ´¾ÙÐÐHTTPÇëÇó¡£

Îå¡¢´úÂëʾÀý

ÒÔÏÂÊÇÒ»¸öʹÓÃPythonÓëMQTTЧÀÍÆ÷ͨѶµÄ´úÂëʾÀý£º

import paho.mqtt.client as mqtt

def on_connect(client, userdata, flags, rc):

print("Connected with result code " + str(rc))
client.subscribe("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

client.connect(“mqtt.eclipse.org”, 1883, 60)

client.loop_forever()

Õâ¶Î´úÂëʹÓÃpaho-mqtt¿âÀ´ÅþÁ¬µ½Ò»¸öMQTTЧÀÍÆ÷²¢¶©ÔÄÖ÷ÌâΪ”test”µÄÐÂÎÅ¡£µ±ÓÐÐÂÐÂÎŵִïʱ£¬½«´òÓ¡³öÐÂÎŵÄÖ÷ÌâºÍÄÚÈÝ¡£

×ܽá

ͨ¹ýÒÔÉÏ°ì·¨£¬ÄãÒѾ­ÀÖ³ÉÉèÖÃÁËLinuxϵͳÒÔÖ§³ÖÖÇ»ÛÅ©ÒµºÍÅ©ÒµÎïÁªÍøµÄ¿ª·¢¡£ÏÖÔÚ£¬Äã¿ÉÒÔ×îÏȱàдÄã×Ô¼ºµÄÅ©ÒµÎïÁªÍøÓ¦ÓóÌÐò£¬²¢½«Æä°²Åŵ½ÏÖʵµÄÅ©ÒµÇéÐÎÖС£Ï£ÍûÕâƪÎÄÕÂÄܶÔÄãÓÐËù×ÊÖú£¬×£ÄãÔÚÖÇ»ÛÅ©ÒµÁìÓòÈ¡µÃÀֳɣ¡

ÒÔÉϾÍÊÇÉèÖÃLinuxϵͳÒÔÖ§³ÖÖÇ»ÛÅ©ÒµºÍÅ©ÒµÎïÁªÍø¿ª·¢µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿