根据你提供的错误信息,主要有两个问题需要解决。
1. Motor
函数调用参数不足
错误提示:
error: too few arguments to function 'void Motor(int, int, int, int, int, int, int, int, int, int, int, int)'
Motor();
这个错误说明你在调用 Motor()
函数时没有传入必要的参数。根据函数声明,Motor
需要12个整数类型的参数。
解决方法:
在调用 Motor
时,必须传入所需的12个参数。例如:
// 假设你已经定义了这些变量并赋值
int Left1_Speed = ...; // 设置具体值
int Left2_Speed = ...;
int Right1_Speed = ...;
int Right2_Speed = ...;
int qa = ...;
int qb = ...;
int qc = ...;
int qd = ...;
int qe = ...;
int qf = ...;
int qg = ...;
int qh = ...;
// 调用 Motor 函数,并传入所有参数
Motor(Left1_Speed, Left2_Speed, Right1_Speed, Right2_Speed,
qa, qb, qc, qd,
qe, qf, qg, qh);
确保将上述代码中的变量替换为你实际使用的值。
2. digitalWrite()
使用不当
错误提示:
error: expected primary-expression before ')' token
digitalWrite(cu1,)
这个错误是由于在 digitalWrite()
函数调用中漏掉了第二个参数。该函数需要两个参数:引脚号和写入的值(如 HIGH
或 LOW
)。
解决方法:
修正这行代码,如下所示:
digitalWrite(cu1, HIGH); // 或者使用 LOW,根据你的需求选择合适的值。
总结
- 确保每次调用
Motor
函数时都提供12个必要的整数类型参数。 - 在使用
digitalWrite()
时确保包含引脚和状态(HIGH/LOW)的所有必要信息。
如果还有其他问题或更详细的信息需要帮助,请随时告诉我!
内容由零声教学AI助手提供,问题来源于学员提问