Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/124.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 错误:在';之前应为初始值设定项;系统&x27;_C++_Arduino - Fatal编程技术网

C++ 错误:在';之前应为初始值设定项;系统&x27;

C++ 错误:在';之前应为初始值设定项;系统&x27;,c++,arduino,C++,Arduino,所以我试图让我的屏蔽机器人避开和漫游对象,这是我的代码 system : "Propeller Board of Education" ' System configuration freq : "PropBOE Square Wave" ' Square wave signal generator ir : "PropBOE IR Detect" ' IR ob

所以我试图让我的屏蔽机器人避开和漫游对象,这是我的代码

 system : "Propeller Board of Education"             ' System configuration
  freq   : "PropBOE Square Wave"                      ' Square wave signal generator
  ir     : "PropBOE IR Detect"                        ' IR object detection
  drive  : "PropBOE-Bot Servo Drive"                  ' Propeller Boe-Bot servo control
  time   : "Timing"    


  byte objectL, objectR                               //Variables to store results


  system.Clock(80_000_000)                            //System clock -> 80 MHz
  freq.Out(4, 1000, 3000)                             //P4 sends 1 s, 3 kHz tone to speaker

  repeat                                              //Main loop repeats indefinitely
    objectL := ir.Detect(13, 12)                      //Check for left object
    objectR := ir.Detect(0, 1)                        //Check for right object

    if objectL == 0 and objectR == 0                  //If no objects detected
      drive.Wheels(100, 100)                          // ...go forward
    elseif objectL == 1 and objectR == 1              //If both sensors detect objects
      drive.Wheels(-100, -100)                        //...back up
    elseif objectR == 1                               //If only right detects
      drive.Wheels(-100, 100)                         //...turn left
    elseif objectL == 1                               //If only left detects
      drive.Wheels(100, -100)                         //...turn right

    time.Pause(20)                                    //Wait 20 ms & before repeating loop  
但是,我收到了这个错误消息

    Arduino: 1.8.3 (Mac OS X), Board: "Arduino/Genuino Uno"

    Avoid_and_Detect:4: error: expected initializer before 'system'
       system.Clock(80_000_000)                            //System clock -> 80 MHz
   ^
exit status 1
expected initializer before 'system'

如何解决这个问题?

您试图用一个非C++的C++编译器编译代码


用C++重写程序或使用适当的编译器。

尽管有标记,但这不是C++代码。这是Pascal吗?请用编译说明编辑您的文章。例如,您使用的编译器以及传递给它的参数是什么。如果这是Pascal或Ada,那么
begin
end
对在哪里?