Help Connecting Lego EV3 to Android phone via bluetooth

696 views
Skip to first unread message

epo...@gmail.com

unread,
Jul 21, 2014, 2:10:27 PM7/21/14
to mitappinv...@googlegroups.com
I need to create an app for my work. I have a robot that draws on the side walk, but it is connected to my phone over wifi using a terminal. I want to create an appliication that will allow me to select an image from a list and send that information by bluetooth to my robot. I need help programming this on app inventor.

epo...@gmail.com

unread,
Jul 21, 2014, 2:48:06 PM7/21/14
to mitappinv...@googlegroups.com
The robot that i am usiing is the lego ev3

SteveJG

unread,
Jul 21, 2014, 3:08:43 PM7/21/14
to mitappinv...@googlegroups.com
Do the tutorials to learn to program.   http://appinventor.mit.edu/explore/ai2/tutorials.html     and read the articles at the bottom of the Web page here:  http://www.appinventor.org/book2     When you are 
done, you will have the programming tools to do what you want to do probably.

Search this forum for   Lego NXT  to get a list of discussions within the forum:  https://groups.google.com/forum/#!searchin/mitappinventortest/nxt

Look here:  https://www.google.com/search?q=app+inventor+lego+nxt&oq=app+inventor+lego+nxt&aqs=chrome..69i57j69i64.7280j0j7&sourceid=chrome&es_sm=0&ie=UTF-8    for lots of Lego articles (most of which are in AI Classic blocks, but they are not too different from AI2's blocks).

The basics of what you want to do are not difficult.   Yours sounds like a simple Lego project.

Try some blocks.  If you run into difficulty, post a specific question and also post an image of the blocks you are having issues with and you will probably get help.

Select an image from a list?     Not sure what you mean here... possibly a preprogrammed robot path?      Yes, that should be possible using bluetooth.

Was this helpful?

Regards,
Steve

epo...@gmail.com

unread,
Jul 21, 2014, 4:53:44 PM7/21/14
to mitappinv...@googlegroups.com
Let me rephrase my problem:
Based on everything i've looked up on appinventor. the amount of things i can do through bluetooth is limited to sending text files. The problem is that the lego brick already has the file saved onto it. I need to be able to press a button on my phone and have the robot start drawing on its own, without downloading anyfiles.

SteveJG

unread,
Jul 21, 2014, 5:06:28 PM7/21/14
to mitappinv...@googlegroups.com
All the instructions AI2 can implement on Lego is here:  http://ai2.appinventor.mit.edu/reference/components/legomindstorms.html

What you probably need is here, highlighted in red.

NxtDirectCommands

A component that provides a low-level interface to a LEGO MINDSTORMS NXT robot, with functions to send NXT Direct Commands

Properties

BluetoothClient
The BluetoothClient component that should be used for communication. Must be set in the Designer

Methods

DeleteFile (text fileName)
Delete a file on the robot.
DownloadFile (text source, text destination)
Download a file to the robot.
GetBatteryLevel ()
Get the battery level for the robot. Returns the voltage in millivolts.
GetBrickName ()
Get the brick name of the robot.
GetCurrentProgramName ()
Get the name of currently running program on the robot.
GetFirmwareVersion ()
Get the firmware and protocol version numbers for the robot as a list where the first element is the firmware version number and the second element is the protocol version number.
GetInputValues (text sensorPortLetter)
Reads the values of an input sensor on the robot. Assumes sensor type has been configured via SetInputMode.
GetOutputState (text motorPortLetter)
Reads the output state of a motor on the robot.
KeepAlive ()
Keep Alive. Returns the current sleep time limit in milliseconds.
ListFiles (text wildcard)
Returns a list containing the names of matching files found on the robot.
LsGetStatus (text sensorPortLetter)
Returns the count of available bytes to read.
LsRead (text sensorPortLetter)
Reads unsigned low speed data from an input sensor on the robot. Assumes sensor type has been configured via SetInputMode.
LsWrite (text sensorPortLetter, list list, number rxDataLength)
Writes low speed data to an input sensor on the robot. Assumes sensor type has been configured via SetInputMode.
MessageRead (number mailbox)
Read a message from a mailbox (1-10) on the robot.
MessageWrite (number mailbox, text message)
Write a message to a mailbox (1-10) on the robot.
PlaySoundFile (text fileName)
Play a sound file on the robot.
PlayTone (number frequencyHz, number durationMs)
Make the robot play a tone.
ResetInputScaledValue (text sensorPortLetter)
Reset the scaled value of an input sensor on the robot.
ResetMotorPosition (text motorPortLetter, boolean relative)
Reset motor position.
SetBrickName (text name)
Set the brick name of the robot.
SetInputMode (text sensorPortLetter, number sensorType, number sensorMode)
Configure an input sensor on the robot.
SetOutputState (text motorPortLetter, number power, number mode, number regulationMode, number turnRatio, number runState, number tachoLimit)
Sets the output state of a motor on the robot.
StartProgram (text programName)
Start execution of a previously downloaded program on the robot.
StopProgram ()
Stop execution of the currently running program on the robot.
StopSoundPlayback ()
Stop sound playback.


I imagine  StartProgram (thefilesaveinto's name)   would work.
Start execution of a previously downloaded program on the robot.

sent through bluetooth might work.    

You really need to read some of the links provided to understand how others are using AI2 and bluetooth to control.  There might be a detailed example ... or what you want to 
do is impossible.

Regards,
Steve









Reply all
Reply to author
Forward
0 new messages