Home » Code » Page 13
Category:

Code

  • Connect a push button to a GPIO pin and check for a button press Schematic Code [codesyntax lang=”java”] import com.pi4j.io.gpio.GpioController; import com.pi4j.io.gpio.GpioFactory; import com.pi4j.io.gpio.GpioPinDigitalInput; import com.pi4j.io.gpio.PinPullResistance; import com.pi4j.io.gpio.RaspiPin; import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent; import com.pi4j.io.gpio.event.GpioPinListenerDigital; public class pushbutton { public static void main(String args[]) throws InterruptedException { System.out.println(“Push…

    0 FacebookTwitterPinterestEmail
  • Another example using the pi4j library, this time displaying various clock speeds on your system [codesyntax lang=”java”] import com.pi4j.system.NetworkInfo; import com.pi4j.system.SystemInfo; import java.io.IOException; import java.text.ParseException; public class clockinfo { public static void main(String[] args) throws InterruptedException, IOException, ParseException { System.out.println(“—————————————————-“); System.out.println(“CLOCK INFO”); System.out.println(“—————————————————-“); System.out.println(“ARM Frequency…

    0 FacebookTwitterPinterestEmail
  • This examples uses pi4j library to display operating system information [codesyntax lang=”java”] import com.pi4j.system.NetworkInfo; import com.pi4j.system.SystemInfo; import java.io.IOException; import java.text.ParseException; public class osinfo { public static void main(String[] args) throws InterruptedException, IOException, ParseException { System.out.println(“—————————————————-“); System.out.println(“OPERATING SYSTEM INFO”); System.out.println(“—————————————————-“); System.out.println(“OS Name : ” + SystemInfo.getOsName());…

    0 FacebookTwitterPinterestEmail
Older Posts

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More