I've tried to learn B4R programming the first time.I have the code in C ,I would like to change to be B4R Code.
But I don't know that the code is correct,or not. Please guide me to correct it. (The objective is to familiarize them with the B4R language).
But I don't know that the code is correct,or not. Please guide me to correct it. (The objective is to familiarize them with the B4R language).
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public Serial1 As Serial
'Define the motor pins
Private motor_1A As Pin
Private motor_2A As Pin
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
'Set motor pin 1 as output
motor_1A.Initialize(26,motor_1A.MODE_OUTPUT)
'Set motor pin 2 as output
motor_2A.Initialize(25,motor_2A.MODE_OUTPUT)
'Set motor speed (0-255)
motor_1A.AnalogWrite(255)
motor_2A.AnalogWrite(0)
Delay(3000)
motor_1A.AnalogWrite(0)
motor_2A.AnalogWrite(0)
End Sub