processing - gpio接口树莓派b的问题
问题描述
所以我实际上试图将我的树莓派与电机驱动器连接起来,也使用树莓派相机 v1.3 运行两个电机,但似乎有一些与 gpio 相关的问题。
我正在使用 Raspbian,所以我确实尝试过
sudo apt-get update
sudo apt-get upgrade
但更新似乎并不能帮助我解决问题,更新我的 gpio 接口也没有。
这是我用来在相机找到东西后立即点亮我板上的 LED 的代码。
import processing.io.*; // use the GPIO library
// store the desired state of the LED in a variable
boolean ledOn = false;
void setup() {
// set pin 17 as an output:
GPIO.pinMode(17, GPIO.OUTPUT);
}
void draw() {
if (ledOn == true) { // If the desired state is on, then:
// turn the LED on:
GPIO.digitalWrite(17, GPIO.HIGH);
// and set the background red:
background(255, 0, 0);
}
else { // otherwise:
// turn the LED off:
GPIO.digitalWrite(17, GPIO.LOW);
// and set the background black:
background(0, 0, 0);
}
}
void mouseClicked() {
// When the mouse is clicked, store the opposite of
// ledOn into ledOn, which toggles ledOn:
ledOn = !ledOn;
}
代码编译成功,但返回错误提示
/sys/class/gpio/gpio4/direction: No such file or directory
更新
从头开始重新安装整个操作系统似乎可以解决问题。
解决方案
推荐阅读
- regex - 删除 AS3 中特定单词(字符串)之后的所有内容
- amazon-web-services - CloudWatch 警报触发频率高于预期
- html - 为什么 CSS 伪类不起作用?
- c++ - 如何从 qml Keys.onPressed 调用 qt keyPressEvent(QKeyEvent *event)
- php - 如何将计数结果显示到刀片模板
- ios - 如何在不重叠tableview ios swift中的其他单元格的情况下重用表格视图单元格
- python-3.x - 多个用户如何共享一个 PipFile
- wpf - WPF DataGrid:CanUserAddRows 产生空记录(当然还有空行)
- python-3.x - 计算熊猫中2个日期的分钟差
- c# - 如何在 Visual Studio 2017 中为 .sql 文件创建自定义扩展名