gpio接口树莓派b的问题

时间:2019-03-24 16:32:06

标签: processing raspberry-pi3 raspbian gpio motordriver

所以我实际上是在尝试将树莓派与马达驱动程序连接,也使用树莓派相机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

更新

从头开始重新安装整个操作系统似乎可以解决问题。

0 个答案:

没有答案