尊龙凯时人生就是博

ÔÚLinuxÉÏʹÓÃVisual Studio Code¾ÙÐÐÎïÁªÍø¿ª·¢µÄÍƼöÉèÖÃ

ÔÚlinuxÉϾÙÐÐÎïÁªÍø¿ª·¢Ê±£¬Ò»¸ö¹¦Ð§Ç¿Ê¢ÇÒ¹ãÊÜ¿ª·¢Õßϲ»¶µÄ´úÂë±à¼­Æ÷ÊÇvisual studio code£¨ÒÔϼò³Ævs code£©¡£vs codeÌṩÁ˸»ºñµÄÀ©Õ¹¿â£¬¿ÉÒÔ×ÊÖúÎÒÃǸü¸ßЧµØ¾ÙÐÐÎïÁªÍøÓ¦Óõıàд¡¢µ÷ÊԺͲâÊÔ¡£±¾ÎĽ«Ïò¸÷ÈËÍƼöһЩÔÚlinuxÉÏʹÓÃvs code¾ÙÐÐÎïÁªÍø¿ª·¢µÄÉèÖ㬲¢¸ø³öÏìÓ¦µÄ´úÂëʾÀý¡£

Ê×ÏÈ£¬ÎÒÃÇÐèÒªÔÚLinuxÉÏ×°ÖÃVS Code¡£¿ÉÒÔͨ¹ý¹Ù·½ÍøÕ¾ÏÂÔضÔÓ¦µÄ×°Öðü£¬È»ºóƾ֤ÌáÐѾÙÐÐ×°Öü´¿É¡£×°ÖÃÍê³Éºó£¬ÎÒÃÇ¿ÉÒÔÔÚÖÕ¶ËÖÐÖ±½ÓÊäÈëcodeÏÂÁîÀ´Æô¶¯VS Code¡£

½ÓÏÂÀ´£¬ÎÒÃÇÐèҪװÖÃһЩÕë¶ÔÎïÁªÍø¿ª·¢µÄÀ©Õ¹¡£¿ÉÒÔͨ¹ýµã»÷×ó²àµÄÀ©Õ¹Í¼±ê£¬È»ºóÔÚËÑË÷¿òÖÐÊäÈëÒªº¦×ÖÀ´ÕÒµ½Ïà¹ØµÄÀ©Õ¹²¢¾ÙÐÐ×°Öá£ÒÔÏÂÊÇһЩÍƼöµÄÀ©Õ¹£º

PlatformIO IDE£ºÕâ¸öÀ©Õ¹ÌṩÁËÎïÁªÍø¿ª·¢ËùÐèÒªµÄһϵÁй¤¾ßºÍ¹¦Ð§£¬°üÀ¨´úÂëµ÷ÊÔ¡¢¹Ì¼þÉÕ¼µÈ¡£¿ÉÒÔͨ¹ýÔÚÀ©Õ¹²àÀ¸ÖÐËÑË÷²¢×°Öá£

Arduino Extension for Visual Studio Code£ºÈôÊÇÄãʹÓÃArduino¾ÙÐÐÎïÁªÍø¿ª·¢£¬Õâ¸öÀ©Õ¹Äܹ»Ìṩ¸»ºñµÄ¿ª·¢¹¤¾ßºÍ¿â£¬×ÊÖúÄã¸ü±ã½ÝµØ±àд¡¢µ÷ÊÔºÍÉÏ´«´úÂë¡£

Python Extension for Visual Studio Code£ºÈôÊÇÄãʹÓÃPython¾ÙÐÐÎïÁªÍø¿ª·¢£¬Õâ¸öÀ©Õ¹Äܹ»ÎªÄãÌṩÖÇÄܵĴúÂ벹ȫ¡¢µ÷ÊÔ¡¢µ¥Î»²âÊԵȹ¦Ð§¡£

×°ÖÃÍêÀ©Õ¹ºó£¬ÎÒÃÇ¿ÉÒÔ×îÏÈÒ»¸öеÄÎïÁªÍøÏîÄ¿¡£Ê×ÏÈ£¬ÎÒÃÇÐèÒª½¨ÉèÒ»¸öÎļþ¼Ð×÷ΪÏîÄ¿µÄ¸ùĿ¼¡£È»ºó£¬ÎÒÃÇ¿ÉÒÔÔÚVS CodeÖз­¿ªÕâ¸öĿ¼£¬²¢ÔÚÆäÖн¨ÉèÒ»¸öеÄÎļþ£¬ºÃ±Èmain.py¡£

½ÓÏÂÀ´£¬ÎÒÃÇ¿ÉÒÔ±àдÎïÁªÍøÓ¦ÓõĴúÂë¡£ÈôÊÇÊÇʹÓÃArduino¿ª·¢£¬¿ÉÒÔÔÚmain.cppÎļþÖоÙÐбàд£»ÈôÊÇÊÇʹÓÃPython¿ª·¢£¬¿ÉÒÔÔÚmain.pyÎļþÖоÙÐбàд¡£ÒÔÏÂÊÇÒ»¸öʹÓÃArduinoºÍDHT11´«¸ÐÆ÷µÄʾÀý´úÂ룺

#include <DHT.h>

#define DHTPIN 5
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);
  dht.begin();
}

void loop() {
  float temperature = dht.readTemperature();
  float humidity = dht.readHumidity();

  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.print(" ¡ãC    ");
  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.println(" %");
  
  delay(2000);
}

µÇ¼ºó¸´ÖÆ

ÒÔÉÏ´úÂëʹÓÃDHT11´«¸ÐÆ÷¶ÁȡζȺÍʪ¶È£¬²¢Í¨¹ý´®¿ÚÊä³öЧ¹û¡£

ÈôÊÇÊÇʹÓÃPython¿ª·¢£¬¿ÉÒÔʹÓÃÒÔÏÂʾÀý´úÂ룺

import Adafruit_DHT

sensor = Adafruit_DHT.DHT11
pin = 4

while True:
    humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)

    if humidity is not None and temperature is not None:
        print('Temperature: {0:0.1f} ¡ãC'.format(temperature))
        print('Humidity: {0:0.1f} %'.format(humidity))
    
    time.sleep(2)

µÇ¼ºó¸´ÖÆ

ÒÔÉÏ´úÂëͬÑùʹÓÃDHT11´«¸ÐÆ÷¶ÁȡζȺÍʪ¶È£¬²¢½«Ð§¹û´òÓ¡³öÀ´¡£

ÒÔÉÏÖ»ÊÇһЩ»ù´¡µÄÉèÖúʹúÂëʾÀý£¬ÏêϸµÄÎïÁªÍøÓ¦Óû¹ÐèҪƾ֤ÏêϸÇéÐξÙÐпª·¢¡£VS CodeÌṩÁËÇ¿Ê¢µÄµ÷ÊÔ¹¦Ð§£¬Äܹ»×ÊÖúÎÒÃǸüºÃµØÃ÷È·ºÍµ÷ÊÔÕû¸öÓ¦ÓõÄÔËÐÐÀú³Ì¡£

×ܽáÀ´Ëµ£¬ÔÚLinuxÉÏʹÓÃVS Code¾ÙÐÐÎïÁªÍø¿ª·¢¿ÉÒÔ´øÀ´Ðí¶à±ãµ±ºÍЧÂÊÌáÉý¡£Í¨¹ýºÏÊʵÄÀ©Õ¹×°ÖúÍÏìÓ¦µÄÉèÖã¬ÎÒÃÇ¿ÉÒÔ¸ü¿ìËٵرàд¡¢µ÷ÊԺͲâÊÔÎïÁªÍøÓ¦Óá£Ï£ÍûÒÔÉÏÍƼöµÄÉèÖúʹúÂëʾÀý¶Ô¸÷ÈËÓÐËù×ÊÖú¡£

ÒÔÉϾÍÊÇÔÚLinuxÉÏʹÓÃVisual Studio Code¾ÙÐÐÎïÁªÍø¿ª·¢µÄÍƼöÉèÖõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

13452372176

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

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

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