0

Something very unusual is happening here.

I wrote a program in Java (using Pi4J) to blink a led (to debug the problem).

testPin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01,"TEST",PinState.HIGH);
testPin.blink(100);

If I insert microSD card on an old PI Model B, it works.

If I insert microSD card on a brand new PI 3 Model B, it does not.

It is not only the same program. It is the same everything! Both cases I run the same microSD card, with the same environment. Just changing the hardware.

I thought that the PI 3 Model B was ruined. But, just in case, I decided to test it in Python. IT WORKS! I mean, it works on both computers.

This is the Python program:

import RPi.GPIO as GPIO        
import time                               
GPIO.setmode(GPIO.BOARD)   
GPIO.setwarnings(False)          
GPIO.setup(12, GPIO.OUT)       
while(1):                                   
    print("ON\n")          
    GPIO.output(12, 1)               
    time.sleep(1)                        
    print("OFF\n")      
    GPIO.output(12, 0)               
    time.sleep(1) 

It is driving me crazy. It does not make any sense.

Environment:

java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)

Obs: I use this Java version to have JavaFX

Linux raspberrypi1 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 armv7l GNU/Linux

pi4j version 0.0.5 

Any clue? Tks!

1

Problem solved.

It was the Pi4J version. I migrated to the latest version (1.1) and it worked.

Tks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.