RPi and Java Embedded GPIO: Java code to blink more LEDs
Posted
by hinkmond
on Oracle Blogs
See other posts from Oracle Blogs
or by hinkmond
Published on Fri, 16 Nov 2012 02:13:28 +0000
Indexed on
2012/11/16
5:07 UTC
Read the original article
Hit count: 313
/Java Embedded
Now, it's time to blink the other GPIO ports with the other LEDs connected to them. This is easy using Java Embedded, since the Java programming language is powerful and flexible. Embedded developers are not used to this, since the C programming language is more popular but less easy to develop in.
We just need to use a dynamic Java String array to map to the pinouts of the GPIO port names from the previous diagram posted. This way we can address each "channel" with an index into that String array.
| |||
With this new dynamic array, we can streamline the main() of this Java program to activate all the ports.
And, then simply add array code to where we blink the LED to make it blink all the LEDS on and off at once.
|
It's easier than falling off a log... or at least easier than C programming.
© Oracle Blogs or respective owner