Open jcarvalhogo opened 8 years ago
Hello,
the problem is, that bulldog doesn't use /sys to access gpio, it uses /dev/mem instead. You need to run you app with root permisions in order to access /dev/mem. This is due to direct access to registers.
Best Regards
right, thank you for your reply! lease you could describe an example using digital input? I intend to count the pulse encoder.
I'm using this code to test the digital input, and it is with him to give the error
//Detect the board we are running on Board board = Platform.createBoard();
//Set up a digital output
//DigitalOutput output = board.getPin(CubieboardNames.PG1).as(DigitalOutput.class);
DigitalInput input = board.getPin(CubieboardNames.PG2).as(DigitalInput.class);
System.out.println("Foi bem assim mesmo ... " + input.read());
thank you!!
Hello, still can not use Digital Input on cubieboard, below the test code.
public static void main(String[] args) { //Grab the platform the application is running on Board board = Platform.createBoard();
//Set up a digital input
DigitalInput buttonSignal = board.getPin(CubieboardNames.PG1).as(DigitalInput.class);
//Create the button with this DigitalInput
Button button = new Button(buttonSignal, Signal.High);
//Add a button listener
button.addListener(new ButtonListener() {
@Override
public void buttonPressed() {
System.out.println("PRESSED");
}
@Override
public void buttonReleased() {
System.out.println("RELEASED");
}
});
while(true) {
BulldogUtil.sleepMs(50);
}
}
someone could tell me where I am going wrong?
this below is the content of my folder dist
README.TXT
TesteLed.jar
bulldog-linux-native-cubieboard.so
lib
below this the log of execution: root@Cubian:/home/cubie/NetBeansProjects/TesteLed/dist# java -jar TesteLed.jar a4901000, a4901000 IOException: java.nio.file.NoSuchFileException: /sys/class/gpio/gpio7/direction
my operating system and Cubian X1 nano
Help me prease !!!
Greetings friends, I'm loving bulldog however I am with the following problem: Connecting to 192.168.1.40:22 cmd : cd '/home/cubie/NetBeansProjects//TesteLed'; '/usr/lib/jvm/java-8-oracle/jre/bin/java' -Dfile.encoding=UTF-8 -jar /home/cubie/NetBeansProjects//TesteLed/dist/TesteLed.jar /dev/mem: Permission denied Exception in thread "main" io.silverspoon.bulldog.linux.util.MMapFailedException: Unable to open file /dev/mem at io.silverspoon.bulldog.linux.io.mmap.MemoryMap.(MemoryMap.java:34)
at io.silverspoon.bulldog.linux.io.mmap.MemoryMap.(MemoryMap.java:28)
at io.silverspoon.bulldog.cubieboard.gpio.CubieboardGpioMemory.(Unknown Source)
at io.silverspoon.bulldog.cubieboard.Cubieboard.(Unknown Source)
at io.silverspoon.bulldog.cubieboard.Cubieboard.getInstance(Unknown Source)
at io.silverspoon.bulldog.cubieboard.CubieboardBoardFactory.createBoard(Unknown Source)
at io.silverspoon.bulldog.core.platform.Platform.createBoard(Platform.java:26)
at br.com.Led.main(Led.java:26)
Exception in thread "Thread-0"
java.lang.NullPointerException
at io.silverspoon.bulldog.cubieboard.Cubieboard.cleanup(Unknown Source)
at io.silverspoon.bulldog.core.platform.AbstractBoard$1.run(AbstractBoard.java:136)
/Users/Josemar/Dropbox/Clientes/TesteLed/nbproject/remote-platform-impl.xml:105: The following error occurred while executing this line:
/Users/Josemar/Dropbox/Clientes/TesteLed/nbproject/remote-platform-impl.xml:63: Remote command failed with exit status 1
BUILD FAILED (total time: 18 seconds)
I just can not run with root after I run twice I have get message: IOException: java.nio.file.NoSuchFileException: /sys/class/gpio/gpio8/direction
my GPIO this directory like this: ls /sys/class/gpio/ export gpio8_pg2 gpiochip1 unexport cubie@Cubian:~/NetBeansProjects/TesteLed/dist$
I believe the error is here: gpio8_pg2 is != gpio8 I tried to compile the sources with the possible solution however was unable
I was doing something to type below public class Gpio {
}
can anybody help me?