Getting an I2C device to work with your Raspberry PI requires a few steps, in this guide we show how to enable this. First of all you have to start up the raspian config tool, you do this as follows [codesyntax lang=”bash”] sudo raspi-config [/codesyntax]…
shedboy71
-
-
In this example we use the database we created in the create database example and we will simply display all rows in the database [codesyntax lang=”python”] #!/usr/bin/python import sqlite3 as lite import sys con = lite.connect(‘test.db’) with con: cur = con.cursor() cur.execute(“SELECT * FROM Jobs”)…
-
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…
-
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…
-
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());…
-
The first step is to verify if you have java installed , to do this open a command prompt and type the following java -version This should return something like the following, if not you’ve probably got an older version of Raspbian or equivalent that…