B4X:
Sub Process_Globals
Dim button1, button2, pin6 As Pin
End Sub
Sub AppStart
pin6.Initialize(6, pin6.MODE_OUTPUT)
button1.Initialize(7, button1.MODE_INPUT_PULLUP)
button2.Initialize(8, button2.MODE_INPUT_PULLUP)
button1.AddListener("Button_Change")
button2.AddListener("Button_Change")
End Sub
Sub Button_Change (Value As Boolean)
Log("Button Change")
'Value will be false when the button is pressed because of the pull up resistor.
If Button1.Read = True Or Button2.Read = True Then
pin6.Write(False)
Else
pin6.Write(True)
End If
End Sub
Blink program:
B4X:
Sub Process_Globals
Dim pin13 As Pin
Dim Timer1 As Timer
End Sub
Sub AppStart
pin13.Initialize(13, pin13.MODE_OUTPUT)
Timer1.Initialize("Timer1_Tick", 1000)
Timer1.Enabled = True
End Sub
Sub Timer1_Tick
pin13.Write(Not(pin13.Read))
End Sub