-
Notifications
You must be signed in to change notification settings - Fork 28
Have a 'Type' for GPIO Object that can be input or output #28
Comments
This is going to sound crazy... but you cannot set a pin and then get it's value. GPIO doesn't really work this way. A pin is either a setter or a getter. Once you set a pin, it's marked as an "input" pin with the value of "high" (or "low"). Once you get a pin, it's marked as an "output" pin with no guarantee that it will hold the value of the previous set operation. @anmenaga can explain this further. |
Hum, my bad, Arduino (bad) habits :-D Maybe we should have an object 'GPIOPin' with a 'type' = input|output and a Value that we can get/set if the type is Output or simply get if the type is Input. BTW: thank you for you fast and detailed answer ;-) |
That's a great idea :) lets change the name of this issue to support that. |
After digging a bit in docs (I'm not quite familiar with Arduino GPIO), it seems that is really easy to read status of an output pin. Example with GPIO 2:
I'll have a look if it's possible to use existing WirePi/RaspberryIO method or PR something to these projects to support that ;-) |
That would be awesome! Pull requests always welcome 😃 |
So I'm new to GPIO but not to PowerShell. My history on Po$h is that a Get- would get the value of whatever object that value is holding or set to. When it comes to GPIO how is Get-GPIOPin to be used? How would you get the value of say Pin 2 to see if it's currently "High" or "Low"? |
You would just use You would only use You would only use |
It took me a while to understand this 😆 |
RaspberryIO can read a pin value like this. |
Hi,
Using Get-GpioPin on a pin will force its level to 'low'.
To reproduce (even if the pin is not connected to anything):
Set-GpioPin -Id 0 -Value High
The pin is high.
Get-GpioPin -Id 0
Returns:
And the pin is low :-/
The text was updated successfully, but these errors were encountered: