首页 > 解决方案 > 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

更新

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

标签: processingraspberry-pi3raspbiangpiomotordriver

解决方案


推荐阅读