This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] BEAGLEBN:运行脚本时出错

Guru**** 2589280 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/590516/beaglebn-error-running-script

器件型号:BEAGLEBN

您好!

我使用的是 BeagleBone Black Rev C  

我正在尝试运行一个简单的程序、以使用按钮打开 LED。但遇到此错误

/usr/local/lib/node_modules/bonescript/my.js:57.
if (slot[0]){
^μ A
类型错误:无法读取空的属性"0"
在 Object.exports load_dt (/usr/local/lib/node_modules/bonescript/my.js:57:20)
在 Object.exports.create_dt (/usr/local/lib/node_modules/bonescript/my.js:123:33)
请访问 Object.exports.setPinMode (/usr/local/lib/node_modules/bonescript/hw_capemgr.js:83:12)
在 Object.f.pinMode (/usr/local/lib/node_modules/bonescript/index.js:160:15)
在对象上。 (/var/lib/cloud9/blinkled/readButton.js:7:3)
在 Module._compile (module.js:456:26)
在 Object.Module._extensions.js (module.js:474:10)
在 Module.load (module.js:356:32)
在 Function.Module._load (module.js:312:12)
在 Module.runMain [AS _onTimeout](module.js:497:10)

我的代码是...

var b =需要('bonescript ');
VAR led ="P9_14";
VAR 按钮="P8_11";
b.引脚模式(led、b.output);
b. pinMode (Button、b.input);
VAR state = b.low;
b. digitalWrite (led、state);
b. attachInterrupt (Button、true、b.change、toggle);
函数切换(x){
如果(x.value ==b.high){
console.log ("按钮为高电平");
b. digitalWrite (led、b.high);

否则{
console.log ("按钮为低电平");
b. digitalWrite (led、b.low);

我通过使 P9_14成为输出来获得此错误。