Hi, All
If to make some separate code module for working with pins:
when i try to add the pin and next get it back:
pin is always empty, with zero GPIO, not saved.
Impossible to have pins in array ?
If to make some separate code module for working with pins:
B4X:
Sub Process_Globals
Type ButtonState (pin As Pin, lastState As Boolean, currentState As Boolean, lastDebounceTime As ULong, pressStartTime As ULong, pressDuration As ULong, eventGenerated As Boolean, periodicCounter As UInt, pressEventTime As ULong, lastPeriodicTime As ULong)
Private buttons(5) As ButtonState
when i try to add the pin and next get it back:
B4X:
Public Sub AddButton(gpio_num As Byte, pin_mode As Byte)
Dim p As Pin
p.Initialize(gpio_num, pin_mode)
buttons(ButtonsIndex).pin = p
End sub
Private Sub ProcessButton(btn As ButtonState)
Dim reading As Boolean = btn.pin.DigitalRead
pin is always empty, with zero GPIO, not saved.
Impossible to have pins in array ?