RPi and Java Embedded GPIO: Using Java to read input
Posted
by hinkmond
on Oracle Blogs
See other posts from Oracle Blogs
or by hinkmond
Published on Thu, 22 Nov 2012 02:20:03 +0000
Indexed on
2012/11/22
5:07 UTC
Read the original article
Hit count: 295
/Java Embedded
Now that we've learned about using Java code to control the output of the Raspberry Pi GPIO ports (by lighting up LEDs from a Java app on the RPi for now and noting in the future the same Java code can be used to drive industrial automation or medical equipment, etc.), let's move on to learn about reading input from the RPi GPIO using Java code.
As before, we need to start out with the necessary hardware. For this exercise we will connect a Static Electricity Detector to the RPi GPIO port and read the value of that sensor using Java code. The circuit we'll use is from William J. Beaty and is described at this Web link. See: He calls it an "Electric Charge" detector, which is a bit misleading. A Field Effect Transistor is subject to nearby electro-magnetic fields, such as a static charge on a nearby object, not really an electric charge. So, this sensor will detect static electricity (or ghosts if you are into paranormal activity ). Take a look at the circuit and in the next blog posts we'll step through how to connect it to the GPIO port of your RPi and then how to write Java code to access this fun sensor.
|
Hinkmond |
© Oracle Blogs or respective owner