Table of Contents
Mindroid -- controlling NXT with mobile phone
Setup
You have basic skills in Java programming. Programming for Android is based on Java, but you need to setup Android Development Toolkit. The installation process may take some time, so make yourself a coffee/tea. Here are the steps to follow:
- Download and install Android Studio
Pulling project stub from repo
To get the project form Github, clone the following link: Project repository. Use the tutorial fr cloning: Cloning repository
Running first program
To run the Mindroid app, you need to have your device paired with NXT robot. All devices you have got had been paired with all the NXT bricks, so you do not need to do this. However, you need to tell the system to which brick you want to connect to, by changing the following variable to store a name of your robot (change YODA to your robot name).
private static final String ROBOT_NAME = "YODA";
After you have doe this:
- Connect your mobile phone/tablet to the computer
Exercises
Read the tutorial for beginners for Mindroid
Warm up
To complete these exercises you need to write your code in
public void commandProgram()
You can find it in RobotControl
class:
- Write a mobile app that will rotate robot's engine A three times forward with speed 40.
- Write a mobile app that will rotate all of the robot's engines 1 time forward, with speed 10 simultaneously.
More advanced
For the following exercises it would be perfect to have a robot built.
- Write a function called
public void turnRight()
- Write a function called
public void turnLeft()
- Write a function called
public void forward(int noRotations)
- Write a function called
public void backward(int noRotations)
- Write a function called
public void turnAround()
- Write a function called
public void forward(int centimeters)
- Write a function called
public void backward(int centimeters)
- Advanced: add buttons to mobile app so that pressing the button will call different functions. This will be kind of remote control for robot. See this tutorial on how to add a button and handle different touch events: Android buttons and touch events