1. Raspberry Pi GPIO

Here is a snippet of Eu code that controls the brightness of a led (light-emitting diode) connected to the Raspberry Pi! It is based on the Wiring Pi library which is written in C.

without warning 
include std/os.e 
 
-- Setup GPIO pins 
integer pinMode = 0 
if ( setupGPIO(pinMode) ) < 0 then 
        abort(1) 
end if 
 
-- Set pin 1 to PWM 
constant PWM = 2 
pinMode(1, PWM) 
 
-- Set the initial brightness of the LED 
integer bright = 0, inc = 10 
pwmWrite(1,bright) 
 
-- While loop that changes LED brightness 
while( get_key() < 0 ) do 
        pwmWrite(1, bright) 
        bright += inc 
        if bright >= 1020 or bright <= 0 then 
                inc = -inc 
        end if 
        sleep(0.01) 
end while 
 
-- Turn LED off 
pwmWrite(1,0) 

Would something along these lines be useful to add support for?

Thanks,
Ira

new topic     » topic index » view message » categorize

2. Re: Raspberry Pi GPIO

Jerome said...

Here is a snippet of Eu code that controls the brightness of a led (light-emitting diode) connected to the Raspberry Pi! It is based on the Wiring Pi library which is written in C.

Would something along these lines be useful to add support for?

Thanks,
Ira


I believe that any i/o can be useful on a controller.

Especially if the Pi can recieve commands from the lan into a Euphoria program, which can then operate the i/o pins.

useless

new topic     » goto parent     » topic index » view message » categorize

3. Re: Raspberry Pi GPIO

useless_ said...


I believe that any i/o can be useful on a controller.

Especially if the Pi can recieve commands from the lan into a Euphoria program, which can then operate the i/o pins.

I think this should be fairly straightforward depending on the commands over lan. I've had good success with sockets/udp in Eu, and we now have GPIO support. For the GPIO pins, you could also do digital writes to set the pin high or low.

Thanks,
Ira

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu