[Gambas-user] Question about gambas and raspberry

T Lee Davidson t.lee.davidson at gmail.com
Mon Apr 6 15:48:04 CEST 2020


On 4/6/20 7:51 AM, Pierre Deswysen wrote:
> Hello,
> 
> I discover Gambas, which I haven't used for a few years.
> 
> I use the pigpio library.
> Installation and use ok following example here :
> https://elinux.org/RPi_GPIO_Code_Samples#Gambas_with_pigpio
> 
> I have a problem because I don't know how to read a GPIO entry without using a button.
> 
> 
> I have this function
> 
>     /Public Sub Counter1()
>     //Print "counter"
>     //gpioSetMode(PinButton1, InputPin)/
>     /Do
>     //
>     //  If gpioRead(PinButton1) = 0 Then
>     //    Button1CounterValue = Button1CounterValue + 1
>     //     Print CounterValueButton1
>     // ValueBox1.Value = ValueCounterButton1
>     //    Wait 1
>     //  Endif
>     //
>     //Loop
>     /
>     /End/
> 
> 
> I'm running this function in :
> 
>     /Public Sub Form_Open()//
>     //End/
> 
> 
> But gambas don't...
> I'm thinking of an endless loop problem
> 
> Thank you in advance for your advice
> 
> Pierre

It is difficult to determine what may be happening especially since you use *three different* variables in the Do loop:
     Button1CounterValue = Button1CounterValue + 1
      Print CounterValueButton1
  ValueBox1.Value = ValueCounterButton1

First, you increment Button1CounterValue.
Then, you print CounterValueButton1; a different variable.
Finally, you assign the value of ValueCounterButton1; yet another different variable.

And, the example you linked to does not have any of that. Could you perhaps send a complete example project so we can better see 
what the overall environment is?


-- 
Lee


More information about the User mailing list