Hallo,
kann mir wer sagen wie ich an die Info komme wann ein InputPin ein Signal bekommt??
Zum beispiel wenn ich vor dem Input nen Taster packe etc....
mfg
Hallo,
kann mir wer sagen wie ich an die Info komme wann ein InputPin ein Signal bekommt??
Zum beispiel wenn ich vor dem Input nen Taster packe etc....
mfg
GpioPinInput? Schau mal ob du hier fündig wirst!
Hallo Zebax,
eine Möglichkeit habe ich hier beschrieben:
Reset-Taster am GPIO und Programmierung in Icon (EDIT: 08-OKT-2017 Link im alten Forum)
Der betreffende GPIO-Pin muss auf Eingang gesetzt werden. Dein Programm reagiert auf einen Zustand (0 oder 1) oder Zustandswechsel (0 ==> 1: steigende Flanke oder fallende Flanke 1 ==> 0).
Beste Grüße
Andreas
Hallo Zebax,
Auszug aus Kapitel 12 meines Icon-Kurses:
12.3.2 Traditional approach
At first we want to learn, how GPIO can be
addressed by shell commands using the terminal.
For example, if you want to "read" the status of
the GPIO pin #9, you have to enter:
The first command causes the creation of a new
directory gpio9 within /sys/class/gpio,
containing a file named direction. This file
direction can be written with either "in" or
"out", which we perform with the second
command.
Another file within the new produced directory
gpio9 is value. This file contains information
about the status, e.g. 0 or 1. You can read the
content by
The content is displayed, either 0 or 1. Finally,
you have to "close" what was produced so far, by
If you want to "write" (e.g. to turn on/off a LED) to
that GPIO pin you have to do something like:
If you want to "write" (for example to turn on/off a
LED) to that GPIO pin, you have enter:
turning on the LED, and
respectively, to turn the LED off, again. And,
finally, to "close" everything
If you have some problems because of denied permissions
and so on, you should try to repeat it within the root
terminal, or as substitute user, put a "sudo" in front of those
commands. If it doesn't work, you should try it with
and
And again, if it doesn't work, try
this as substitute user do:
OK. That's how it works with shell commands.
Sry damit kann ich nicht wirklich was anfange ich brauche das ganze für Java
Hallo Zebax,
von Java (oder was auch imer) musst Du obige Linux-Kommandos aufrufen - oder entsprechende Befehle von GPIO-Libraries aufrufen.
Beste Grüße
Andreas
Du brauchst natürlich nicht unbedingt aus Java heraus die Shell-Commandos aufrufen, genau so wenig wie du GPIO - Libraries brauchst.
Sicherlich wird es auch für Java Bibliotheken für Dateisystem-Zugriffe geben (z.b. java.io.* ). Mit denen kannst du genau so auf die o.g. "Dateien" zugreifen. Entsprechende Berechtigungen natürlilch vorrausgesetzt.
Hallo
ich arbeite sehr gerne mit der Bibliothek pi4j.
http://pi4j.com/example/listener.html
hier sind auch ein paar gute Beispiele in JAVA zu finden mit denen du genau dass machen kannst was du beschrieben hast.
rossmann
Du hast noch kein Benutzerkonto auf unserer Seite? Registriere dich kostenlos und nimm an unserer Community teil!