极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 18530|回复: 9

我写的程序一直报错,求大神帮我看看

[复制链接]
发表于 2017-3-12 11:24:20 | 显示全部楼层 |阅读模式
错误如下
C:\Users\ADMINI~1.USE\AppData\Local\Temp\build72c19066c1fa002fdd33c76fabbda763.tmp\sketch\LCD12864RSPI.cpp:12:21: fatal error: wiring.h: No such file or directory

#include <wiring.h>

                     ^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.





  1. #include "LCD12864RSPI.h"
  2. #define AR_SIZE( a ) sizeof( a )/sizeof( a[0] )
  3. #define SensorLED     13
  4. #define SensorINPUT    2
  5. #define MOTO_A  3
  6. #define MOTO_B  4   //电机驱动
  7. #define OPENTIME 500  //开门电机转动时间ms
  8. #define TIMEMAX  4000   //单次超时
  9. #define TIMECOMMAX  12000    //总超时
  10. #define TIMECOMMAX  12000    //总超时
  11. #define FAUL_TRATE_SHOCK 30  //单次敲击时间容错
  12. #define FAUL_TRATE_ERROR 2  //单次敲击次数容错
  13. #define MAXSING 4 //曲目数量
  14. int state = 0;      //震动计数

  15. int sing_Shock = 0 ;  //歌曲次数
  16. int user_Shock = 0 ;  //手敲击次数计数
  17. int sing_Error = 0 ;  //错误次数

  18. int time_ms = 0;   //单次震动计时
  19. int timeCom_ms = 0;  //总计时

  20. int game_switch = 0;  //开始计时标志
  21. int game_flag = 0;    //游戏状态: 0待机中, 1游戏中
  22. int Sing_flag = 0;      //当前歌曲标志
  23. unsigned char SystemArr[3][8]={
  24.   {
  25.       0xD1, 0xE9,
  26.       0xD6, 0xA4,
  27.       0xCA, 0xA7,
  28.       0xB0, 0xDC           //验证失败
  29.   },
  30.   {
  31.       0xD1,0xE9,
  32.       0xD6,0xA4,
  33.       0xB3,0xC9,
  34.       0xB9,0xA6
  35.   },                      //验证成功
  36.   {
  37.       0xBF,0xAA,
  38.       0xC3,0xC5,
  39.       0xCC,0xE1,
  40.       0xCA,0xBE
  41.   }                       //开门提示
  42. };
  43. unsigned char SingNameArr[4][8]={
  44.   {
  45.       0xB9,0xAB,
  46.       0xD6,0xF7,
  47.       0xB5,0xEE,
  48.       0xCF,0xC2
  49.   },                     //公主殿下
  50. {
  51.       0xBB,0xA2,
  52.       0xCE,0xC6,
  53.       0xF6,0xE8,
  54.       0xD3,0xE3
  55.   },                     //虎纹鲨鱼
  56.   {
  57.       0xC4,0xDE,
  58.       0xBA,0xE7,
  59.       0xCA,0xB3,
  60.       0xD6,0xD6
  61.     },                      //霓虹蝕种
  62. };
  63. int SingGameArr0[]={165,520,98,312,116,192,165,180,165,186,180};//公主殿下
  64. int SingGameArr1[]={384,159,135,130,365,158,127,142,360,150,142,150,137};//虎纹鲨鱼
  65. int SingGameArr2[]={117,210,190,130,210,230,210,212,250,110,298,119,233,110};//霓虹蝕种

  66. unsigned int UserGAmeArr[]={ };
  67. void setup()
  68. {
  69.   LCDA.Initialise();//屏幕初始化
  70.   delay(100);
  71.   pinMode(SensorLED, OUTPUT);
  72.   pinMode(MOTO_A, OUTPUT);
  73.   pinMode(MOTO_B, OUTPUT);
  74.   pinMode(SensorINPUT, INPUT);
  75.   attachInterrupt(0, shock,FALLING);//D2为外部中断0
  76.   Serial,begin(9600);
  77.   displaySing();
  78. }

  79. void loop()
  80. {
  81.       if(state!=0)
  82.       {
  83.         sate = 0;
  84.         digitalWrite(SensorLED,HIGH);
  85.         if(time_ms>90){
  86.           if(game_flag==0){
  87.             switch(Sing_flag){//统计歌曲打击次数
  88.               case 0:sing_Sgock = sizeof(SingGameArr0) /sizeof(int);break;
  89.               case 1:sing_Sgock = sizeof(SingGameArr1) /sizeof(int);break;
  90.               case 2:sing_Sgock = sizeof(SingGameArr2) /sizeof(int);break;
  91.               case 3:sing_Sgock = sizeof(SingGameArr3) /sizeof(int);break;
  92.             }
  93.             game_flag=1;
  94.           }
  95.          
  96.           if(user_Shock< sing_Shock){
  97.             /*敲击判断是否正确部分*/
  98.             int Singshock_temp = 0;
  99.             switch(sing_flag){
  100.               case 0;Singshock_temp = SingGameArr0[user_Shock]; break;
  101.               case 1;Singshock_temp = SingGameArr1[user_Shock]; break;
  102.               case 2;Singshock_temp = SingGameArr2[user_Shock]; break;
  103.               case 3;Singshock_temp = SingGameArr3[user_Shock]; break;
  104.             }
  105.             if(time_ms<=(Singshock_temp+FAUL_TRATE_SHOCK)
  106.               &&time_ms>=(Singshock_temp-TRATE_SHOCK))
  107.             {
  108.               //判断成功不做操作
  109.               //Serial.println("su");
  110.             }
  111.             else{
  112.               user_Error++;
  113.             }
  114.             user_Shock++;
  115.            /*敲击判断是否正确部分结束*/
  116.            
  117.            char stringa[25];
  118.            itoa(time_ms,stringa, 10);
  119.            Serial,println(stringa);
  120.            time_ms = 0;
  121.          }
  122.        }
  123.      }
  124.      else if(game_switch!=0){
  125.        delay(1);
  126.        digitalWrite(SensorLED,LOW);
  127.        time_ms++;
  128.        timeCom_ms++;
  129.        if(time_ms>TIMEMAX || (user_Shock == sing_Shock && sing_Shock!=0)){//单次超时或者总超时
  130.          if(user_Shock == sing_Shock
  131.              && user_Error <= FAUL_TRATE_ERROR
  132.              && sing_Shock!=0
  133.              && user_Shock!=0 ){
  134.            LCDA.CLEAR();//清屏
  135.            delay(100);
  136.            LCDA.DisplayString(2,2,SystemArr[1],AR_SIZE(SystemArr[1]));//显示验证失败
  137.            delay(3000);
  138.            openDorr();
  139.            Serial.println("su!!!");
  140.          }
  141.          else{
  142.            LCDA.CLEAR();//清屏  
  143.            delay(100);
  144.            LCDA.DisplayString(2,2,SystemArr[0],AR_SIZE(SystemArr[0]));//显示验证失败
  145.            delay(3000);
  146.         }
  147.         game_switch=0;//待机超时后关闭计时
  148.         time_ms=0;
  149.         timeCom_ms=0;
  150.         user_Shcok=0;
  151.         user_Error=0;
  152.         sing_Shock=0;
  153.         game_flag=0;//待机
  154.    
  155.         Sing_flag++;//换歌
  156.         if(Sing_flag>MAXSING-1){
  157.           Sing_flag=0;
  158.         }
  159.         displaySing();
  160.       }
  161.     }
  162. }

  163. void shock()//数字输入传感器下降沿触发中断服务函数
  164. {
  165.   state++;
  166.   game_switch=1;//激活计时
  167. }

  168. void openDoor(){//开门
  169.   digitalWrite(MOTO_A,LOW);
  170.   digitalWrite(MOTO_B,HIGH);
  171.   delay(OPENTIME);
  172.   digitalWrite(MOTO_A,LOW);
  173.   digitalWrite(MOTO_B,LOW);
  174. }

  175. void displaySing(){
  176.   LCDA.CLEAR();//清屏
  177.   delay(100);
  178.   LCDA.DisplayString(0,2,SystemArr[2],AR_SIZE(SystemArr[2]));
  179.   delay(100);
  180.   LCDA.DisplayString(2,2,SingNameArr[Sing_flag],AR_SIZE(SingNameArr[Sing_Flag]));
  181.   delay(100);
  182. }
  183.    
  184.   
  185.   
  186.             
  187.          
  188.   
复制代码
回复

使用道具 举报

发表于 2017-3-13 09:32:51 | 显示全部楼层
回复 支持 1 反对 0

使用道具 举报

 楼主| 发表于 2017-3-12 11:25:03 | 显示全部楼层
新人一位,各位老师,帮我看看、
回复 支持 反对

使用道具 举报

发表于 2017-3-12 12:28:55 | 显示全部楼层
库文件放正确了没有啊?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-3-12 13:11:29 | 显示全部楼层
kenan13 发表于 2017-3-12 12:28
库文件放正确了没有啊?

应该放哪啊哥我是新人
回复 支持 反对

使用道具 举报

发表于 2017-3-13 09:33:14 | 显示全部楼层
3sh 发表于 2017-3-12 13:11
应该放哪啊哥我是新人

没事多百度便知了。。。
https://zhidao.baidu.com/question/1573758793390643540.html
回复 支持 反对

使用道具 举报

发表于 2017-3-13 23:37:03 | 显示全部楼层
那个库在高版本的arduino中已经没有了 你到LCD12864RSPI.cpp中把wring.h改成arduino.h就行了本来想给你改成能编译的来着结果你程序里有很多没定义的  你在定义一下把
回复 支持 反对

使用道具 举报

发表于 2017-3-14 12:08:24 | 显示全部楼层
这个是能通过校验的你的程序 跟库文件

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2017-3-16 21:35:27 | 显示全部楼层
jzengming 发表于 2017-3-14 12:08
这个是能通过校验的你的程序 跟库文件

楼上好人呀 ~~~赞一个
回复 支持 反对

使用道具 举报

发表于 2017-3-25 16:38:56 | 显示全部楼层
lala5 发表于 2017-3-16 21:35
楼上好人呀 ~~~赞一个

哈哈  共同进步把。。。。。。。。
回复 支持 反对

使用道具 举报

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

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-4-20 16:42 , Processed in 0.041091 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

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