arduino uno小车程序烧录不成功,求大神帮助!!-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1882|回复: 0

[未解决] arduino uno小车程序烧录不成功,求大神帮助!!

[复制链接]
发表于 2021-5-12 14:00 | 显示全部楼层 |阅读模式
程序:
#include <dht11.h>
dht11 DHT11;
#define DHT11PIN 3//DHT11温湿度传感器对应UNO的引脚
unsigned long previousMillis = 0;//记录Arduino上一时刻运行的时间
String comdata = "";
char varW_Temperature = 0,varW_Humidity=0;

void setup(){
    Serial.begin(9600);
    pinMode(12,INPUT);
    pinMode(13,INPUT);
    pinMode(2,INPUT);//左边
    pinMode(4,INPUT);//右边
}

void loop()
{
  //蓝牙遥控模式
      while (Serial.available() > 0)  
    {
        comdata += char(Serial.read());
        delay(2);
    }
     if (comdata.length() > 0)
    {  
      switch(comdata[0])
      {
        case 0x00:{GoStop();}break;//收到app发来00,小车停止
        case 0x01:{GoAhead();}break;//收到app发来01,小车前进
        case 0x02:{GoBehind();}break;//收到app发来02,小车后退
        case 0x03:{GoLeft();}break;//收到app发来03,小车左行
        case 0x04:{GoRight();}break;//收到app发来04,小车右行
        case 0x08:{Serial.write(varW_Temperature);Serial.write(varW_Humidity);}break;//把数据发送到app
        default:{GoStop();}//默认停止     
        }   
    }
   unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= 2000) //2000ms发送一次数据
  {

    int chk = DHT11.read(DHT11PIN);
     varW_Temperature = (float)DHT11.temperature;//DHT11的温度值
     varW_Humidity = (float)DHT11.humidity;//DHT11的湿度值
    previousMillis = currentMillis;

  }

}
void GoAhead()//前进
{
    analogWrite(6,100);//左前   
    analogWrite(10,0);//右前   
    analogWrite(5,0);//左后   
    analogWrite(9,100);//右后
}
void GoBehind()//后退
{
    analogWrite(6,0);   //左前
    analogWrite(10,100);  //右前   
    analogWrite(5,100);   //左后
    analogWrite(9,0);//右后
}
void GoLeft()//左转      
{
    analogWrite(6,0);   //左前
    analogWrite(10,0);//右前  
    analogWrite(5,0); //左后
    analogWrite(9,100);//右后
}
void GoRight()//右转      
{
    analogWrite(6,100);   //左前
    analogWrite(10,0); //右前   
    analogWrite(5,0);  //左后  
    analogWrite(9,0);//右后

}
void GoStop()
{
    analogWrite(6,0);   //左前
    analogWrite(10,0);  //右前  
    analogWrite(5,0);  //左后  
    analogWrite(9,0);//右后
}

错误信息:
Arduino:1.6.7 (Windows 10), 开发板:"Arduino/Genuino Uno"

GetFileAttributesEx D:\Arduino\libraries\Dht11\dht11.cpp D:\Arduino\libraries\Dht11\dht11.h: The filename, directory name, or volume label syntax is incorrect.
编译有误。

  报告将会包含更多的信息
  "在编译时,输出详细信息"
  在 文件>首选项 中启用



您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-29 06:42 , Processed in 0.066640 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表