Read RasPi GPIO

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Read RasPi GPIO

Herbert König
Hi,

I can successfully read a GPIO Pin on the RasPi if I do it like:
|value|
dataFile ensureOpen.
value := dataFile upToEnd.
dataFile close.
^value

dataFile is the /sys/class/gpio/gpioxx/value file that exists after
exporting gpioxx.

Without the reopening and closing of the file I get '' on subsequent
reads which means that
StandartFileStream>>basicNext answers nil.

Is there a way to get the values without having to close and reopen the
file each time?

Thanks

Herbert
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Read RasPi GPIO

Michael Rice
Is there a StandardFileStream>>reset?

Michael

On Wed, Jan 28, 2015 at 7:45 AM, Herbert König <[hidden email]> wrote:
Hi,

I can successfully read a GPIO Pin on the RasPi if I do it like:
|value|
dataFile ensureOpen.
value := dataFile upToEnd.
dataFile close.
^value

dataFile is the /sys/class/gpio/gpioxx/value file that exists after exporting gpioxx.

Without the reopening and closing of the file I get '' on subsequent reads which means that
StandartFileStream>>basicNext answers nil.

Is there a way to get the values without having to close and reopen the file each time?

Thanks

Herbert
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Read RasPi GPIO

Herbert König
Wonderful,
dataFile reset.
^dataFile upToEnd

I thought every read request would just produce a new value.

Thanks,

Herbert

does the trick
Am 28.01.2015 um 14:13 schrieb Michael Rice:
Is there a StandardFileStream>>reset?

Michael

On Wed, Jan 28, 2015 at 7:45 AM, Herbert König <[hidden email]> wrote:
Hi,

I can successfully read a GPIO Pin on the RasPi if I do it like:
|value|
dataFile ensureOpen.
value := dataFile upToEnd.
dataFile close.
^value

dataFile is the /sys/class/gpio/gpioxx/value file that exists after exporting gpioxx.

Without the reopening and closing of the file I get '' on subsequent reads which means that
StandartFileStream>>basicNext answers nil.

Is there a way to get the values without having to close and reopen the file each time?

Thanks

Herbert
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Read RasPi GPIO

Ben Coman
In reply to this post by Herbert König

How about sending #reset to set the stream back to the start ?

On Wed, Jan 28, 2015 at 8:45 PM, Herbert König <[hidden email]> wrote:
Hi,

I can successfully read a GPIO Pin on the RasPi if I do it like:
|value|
dataFile ensureOpen.
value := dataFile upToEnd.
dataFile close.
^value

dataFile is the /sys/class/gpio/gpioxx/value file that exists after exporting gpioxx.

Without the reopening and closing of the file I get '' on subsequent reads which means that
StandartFileStream>>basicNext answers nil.

Is there a way to get the values without having to close and reopen the file each time?

Thanks

Herbert
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners