Open the DisconnectButton drawer and drag out the “when .Click” block
Open the Ev3Motors drawer and drag out the “call .Stop/useBrake” block
Set useBrake to “true” (from the Logic drawer)
Open the StopStartButton drawer and drag out the “set .Text to” and “set .Enabled to” blocks
Set the text to “Start” (from the Text drawer)
Set .Enabled to “false” (from the Logic drawer)
Open the BluetoothClient drawer and drag out “call .Disconnect”
Open the TiltInstructionsLabel drawer and drag out the “set .Visible to” block
Set .Visible to “false”
Open the AccelerometerSensor drawer and drag out “set .Enabled to”
Set .Enabled to “false”
Open the StopStartButton drawer and drag out the “when .Click” block
Open the Control drawer and drag out the “if/then” block
Click the blue settings button and drag an “else” block into the “if”
If the Button’s current text is “Start”, we set its text to “Stop”, show TiltInstructionsLabel, and enable the accelerometer
Open the AccelerometerSensor drawer and drag out the “when .AccelerationChanged” block
Open the Ev3Motors drawer and drag out the “call .RotateSyncIndefinitely” block
Open the Math drawer and drag out two multiplication blocks
Open the Math drawer and drag out two number blocks
The power parameter represents how fast the wheels of the robot are turning
We want the robot to go forward when we pitch the phone forward, so we hover over the “xAccel” variable of this “when” block to “get xAccel”. We multiply “get xAccel” by a number to increase its effects
This multiplication block plug into the power variable
The turnRatio parameter represents the difference in turn speed between the two wheels (i.e. how much the robot is turning). A turnRatio of 0 means the robot is going in a straight line
We want the robot to turn when we pitch the phone left or right, so we use the “get yAccel” block. A negative multiplier worked for me in this case.