Raspberry Pi – Part IV – Simple Wiring Test

I am plugging away working with my Pi. I went back to the Ada Fruit Site, and started working on one of the tutorials from the part I purchased – https://www.adafruit.com/products/2125   I want to be able to demonstrate a simple wiring with my Pi works.

I selected Email Notifier. I read through it, and realized I needed to convert it to work for the B+ model. The pi4j website has a nice diagram for the pins http://pi4j.com/images/j8header-b-plus-large.png and I simplified the test a bit.

I launched the simple python file

pi@seconds ~ $ sudo python testPi.py
Pi with a Green Light - Using Python
Pi with a Green Light – Using Python

I added the pi4j dependency to my maven pom

<dependency>
    <groupId>com.pi4j</groupId>
    <artifactId>pi4j-core</artifactId>
   <version>1.0</version>
</dependency>

I create a servlet which replicated the same code from before (GPIO).

I copied the war file to the local webapp directory, and restarted jetty

pi@seconds /opt/jetty/web/bbq/webapps $ sudo cp ~/pi.webapp.war ./
pi@seconds /opt/jetty/web/bbq/webapps $ sudo chown jetty:jetty pi.webapp.war
pi@seconds /opt/jetty/web/bbq/webapps $ sudo /etc/init.d/jetty restart

Refer to https://wiki.eclipse.org/Jetty/Howto/Deploy_Web_Applications  and I did have to add –module=jsp to the start.ini for my web configuration.

I hit the servlet – http://192.168.1.200/pi.webapp/Control?status=true

Exception
Exception

Which makes sense, since “Software using the Pi4J library must be run with ROOT level permissions.” (actually it doesn’t since I am running as root)…

Issues remain.  I’ll tackle them on a different day 🙂   … Part 5 …

Leave a Reply

Your email address will not be published. Required fields are marked *