Control Robot with Max
For a project that I’m currently working on I’m trying to get a robot move on 2 wheels… each wheel are attached separately to two different motors which I’m controlling through Arduino. So far this is what I got: Through serial communication I can send the commands to my Arduino board, I’m using a [KEY] object on Max to do so. With the arrows of the keyboard I can make the robot go North-East-South-West (with the four arrow keys).
Now, I want to get Northeast-Southeast-Northwest-Southwest as well… I can’t figure it out how to make it with the Key object to detect when two arrows keys are pressed at the same time. I don’t want to stop the robot moving for changing directions but to be able to change it as it’s moving…
Some clues over there how to make this work??
(I hope the idea is clear!)
Here’s one way to do it, did it only for North west but you get the idea:
<code>-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1027.3oc0Y1rjahCDG+r8SgJUakSNSoVefgTUNjWf85dXqTov1J1JqM3BjmY RRk28EIAdYlXajsAsLWLf.D+6epk5Vs+4zI3E4OKKwnOf9azjI+b5jI1lLML o95I3coOubaZo8wvKy2sSlowyb2SKeVaa+OyKzaP+kr73s9Zw5ElaQdfzzRd ltT8CooUfdr4rC6TYakZ6G.pabepd4FU15uTHWpcBLl7fXFhSLuIZtoaQzpe Qe9+5m7C5lNpo2Uqr5Kew2deDA2RIYo6rJA+oBU5Vr4F+Z5TyOy7jE570q2J wWoYvSZYFztLilNx0j966ktdAqpFDN9NsLRQL932tnxD0xhuHyRWr09hjavL yjOU0w+1HtFs.ovWdncegrrxaIUqxyZg.FiYM63DyAR8OsIfWjjwDlWkQYtC FtdATROGJWjlsFO6BHMpe8a5efR4Pe.z5tY3ApXz.TeQCHhBCZ3AAMpuh9CE f93GQ.5cuq5bZqyYlyIty4ty0ajYU2VtsThHWCR4csPHKxA15kDtgUBOMGY8 KGOWbuxqNb24lBC14dI76aFbUuHZ5EH45iQJnggaY8E2fD1CyE2M3LcC4t.G DFvI6MvMOx5pDcebada7eSfiDFv8zfkXJHhuuIc7j.EOjzSQCYrJemXFiyqL XtakademIKk9ViJ.K.Tg8FiJzDR.nB+sFUhl+.ULjDouyw9vtExhdx5SrabC .qUK5ZOvzKY6ypyo9jL3RwjC0tjgabKctcZ.7dIgvAyMCBUnqaEiDWTYm8eu oGNbXLdbiQXdbufw5rEGNNFMR33UVWggCHhwPMOowysFFHFlhdB79d47ayNA 2tonv.UbWfNNryl5MxmOP1IYTYmlsJOH1YnpUeoba0bvpTwQLR01TtwPoBGL .R2w.Ddj4qK6ujtp6mnqRodtimj3gI9v+H+9g8WSDBR27x4JJR5nxy7NRV92 ObxxmFDLcctk95f0DR8+E+Kdn7u5IuqZXETmKOqTp8UwaUYu9en1ZFl1eI3J yOTrrQPM+ucH3nBVIK0pL6pZseHV0CwN9PaTqVIyZCsUpRyJxqN+RxdqGgu5 gFF8X3CwG8PBGeFQ5wjUY25IJb5g3idDga7h4idhCmd3iL+Ytuy2gv3+PGW7 I1G4vClbn9fmWMGbPGtRFW5g5yz8vMaGhGUxg5yhOP37lgnwkdn9Db+UqPMj 5I5Eo8cZ4PCqbncIGVPkSWQtn7fJmt7cngKwGXj4KC9fGHXxg6wTqWEbankS WSsf3fJmtlZAQAUNc5JKFUtxgacGelmeqCUtxajte+ixhx5tzJD7tzukWXtL Zl8RUl6Ra4kwExGUMOOy1RZwxMJsbo9PgqTJOGGgmZ9N+Z5+BSZ33AB -----------end_max5_patcher-----------
Hi Nat! Thanks a lot for the help. I managed to reach what I went through that way! Super ^^
ps. Is the Toolboox still working on Max 6?? I’ve been trying to make it work but yet with no luck… I followed instructions but shortcuts don’t respond and also I cannot make the Shell (Shift+r) window appear on my max.
(hey, here i’m working without problem with that dear ToolBox on latest max614,32bitsOSX1068. though, it should be noted that toolbox won’t work in helpfiles, because there are incompatible js scripts apparently. I can make shell appear too.)
Looks weird as I can’t either open the Shell window with the Shift+R keys… I found some external Shell object but it seems that it won’t perform the same way as doing it from the shell window. In the other hand can’t make it work with shortcuts either, maybe I’m just doing it in the wrong way… Any clue??
I’m running Max 6.0.4 on a OSX 10.7.5
Thanks for the help!
It should work fine in max 6. When you open max do you see a toolbox message in the max window ? What version is installed ?
Hi Nat! My Max is a 6.0.4 running on a OSX 10.7.5 MacBook Pro computer… and the ToolBox version is the "maxtoolbox_14_max5" recently downloaded from your site.
It’s possible to find the Toolbox from the extras menu on Max which I’ve already Activated… but when trying to use the shortcuts it’s not working and as I said it’s also not possible to launch shell window when pressing Shift+R.
Perhaps I’m trying to use the shortcuts in the wrong way?? Is it just like choosing the object and hold the shortcuts keys to the other?? I’ve tried in many different ways to make the connection but not finding the way yet!
Thanks a lot again for the information!
Can you try removing completely and try this version ?
Perfectly working now! Thanks a lot man, this really makes difference at the moment of patching ^^
Thanks for the support, now is time for easy patching!
Forums > MaxMSP