I have a very small python script to control GPIOs:
pi@raspberrypi ~ $ sudo python gpio-test.py
#!/usr/bin/env python
try:
from time import sleep
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(6, GPIO.OUT)
GPIO.output(6,True)
while True:
sleep(1);
finally:
GPIO.cleanup()
The script does not take any effect with the GPIO6 where I have a led.
I've made another java program using the library pi4j and it works fine turning the led ON for 5 seconds:
package test;
import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.GpioPinDigitalOutput;
import com.pi4j.io.gpio.PinState;
import com.pi4j.io.gpio.RaspiPin;
public class GPIOTest {
static final GpioController gpio = GpioFactory.getInstance();;
static final GpioPinDigitalOutput[] output = new GpioPinDigitalOutput[15];
public static void main(String[] args) {
output[6] = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_06, "output6",PinState.LOW);
output[6].setState(PinState.HIGH);
Thread.sleep(5000);
output[0].setState(PinState.LOW);
gpio.shutdown();
}
}