1. Raspberry Pi GPIO
- Posted by Jerome Jan 06, 2013
- 1452 views
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
2. Re: Raspberry Pi GPIO
- Posted by useless_ Jan 06, 2013
- 1430 views
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
3. Re: Raspberry Pi GPIO
- Posted by Jerome Jan 07, 2013
- 1365 views
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