Nico Marikucza

unread,
Oct 26, 2016, 11:03:17 AM10/26/16
to mitappinv...@googlegroups.com
Hello,

Today I will show you how to control a Ev3 robot with a Pan/Tilt. First of all, you 2 Buttons and a list picker pulls in the Designer.
Call the list picker “connect list picker” and set the Text to “Connect”.
Call the first Button “stop-start button” and the second "disconnect button".
Set the Enabled Property at the stop start button to false and set the Text to “Start”.
Draw a Label in the Designer and call him “TiltInstructionsLabel”, set the Text to “Tilt-to-control robot” and set the Visible Property to false.

Prefer a Bluetooth client, an Accelerometer sensor, and Ev3Motors in the Designer.
Go to the Ev3 Motors-Properties and set the Bluetooth Client to the Bluetooth-Client. Change the Motor Ports to BC.

In The Blocks Editor:
a. Click in the Component bar, click "connect list picker", drag the Event "when .Before picking" and the " Set " Block "set .Element to" in the Viewer.
b. Click in the Component list on the "BluetoothClient1" and pull the Get-Block ".AddresssAndNames" in the Editor
c. Click in the Component bar, click "connect list picker" and drag the "When .After picking" in the Viewer d. Click on the "Control" and drag out an If Then Block in the Viewer. e. Click on "BluetoothClient1" and drag the "call .Connect" Block in the Viewer f. Click the "connect list picker" and drag the " .Selection"Block in the Viewer g. Click on stop start button, and drag the "Set .Enabeld to" Block in the Viewer h. Click on logic and drag out a true Block in the Viewer.
  1. Open the DisconnectButton drawer and drag out the “when .Click” block

  2. Open the Ev3Motors drawer and drag out the “call .Stop/useBrake” block

  3. Set useBrake to “true” (from the Logic drawer)

  4. Open the StopStartButton drawer and drag out the “set .Text to” and “set .Enabled to” blocks

  5. Set the text to “Start” (from the Text drawer)

  6. Set .Enabled to “false” (from the Logic drawer)

  7. Open the BluetoothClient drawer and drag out “call .Disconnect”

  8. Open the TiltInstructionsLabel drawer and drag out the “set .Visible to” block

  9. Set .Visible to “false”

  10. Open the AccelerometerSensor drawer and drag out “set .Enabled to”

  11. Set .Enabled to “false”

  1. Open the StopStartButton drawer and drag out the “when .Click” block

  2. Open the Control drawer and drag out the “if/then” block

  3. Click the blue settings button and drag an “else” block into the “if”

  4. If the Button’s current text is “Start”, we set its text to “Stop”, show TiltInstructionsLabel, and enable the accelerometer

  5. If the Button’s current text is “Stop”, we brake the robot, set the button’s text to “Start”, hide TiltInstructionsLabel, and disable the accelerometer
  1. Open the AccelerometerSensor drawer and drag out the “when .AccelerationChanged” block

  2. Open the Ev3Motors drawer and drag out the “call .RotateSyncIndefinitely” block

  3. Open the Math drawer and drag out two multiplication blocks

  4. Open the Math drawer and drag out two number blocks

  5. The power parameter represents how fast the wheels of the robot are turning

  6. 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

  7. This multiplication block plug into the power variable

  8. 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

  9. 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.

  10. If these multipliers don’t correspond to how fast you want your robot to go or the correct direction, you can test it and change the values.
The final results you will see in the attachments
APK and AIA files in the Annex



---

apk file removed, see the Posting Guidelines.
Taifun

EV3_Demo.aia
Blocks.png

Evan Patton

unread,
Oct 26, 2016, 4:03:46 PM10/26/16
to MIT App Inventor Forum
Nico,

This appears to be almost word-for-word copy of Natalie Lao's LEGO EV3 Tutorial. Further, the AIA and APK files you posted were the exact versions from Natalie (we checked the packages), and your screenshots are hers as well (you can see her name logged in to Chrome). Please do not post copies of other people's materials on this forum without proper attribution. 

Evan

Nico Marikucza

unread,
Oct 28, 2016, 8:24:42 AM10/28/16
to MIT App Inventor Forum
Ok! I'm sorry
Reply all
Reply to author
Forward
0 new messages