Welcome to the Android Central Forums Create Your Account or Ask a Question Answers in 5 minutes - no registration required!
Results 1 to 1 of 1
  1. Thread Author  Thread Author    #1  

    Cool CellBots control code

    Hi

    I try to activate the 3:rd wheel on a lego mindstorm nxt robot by adjusting cellbots code in eclipse.
    It can be remote controlled from a webpage with keys
    index.html - cellbots - Using Cellphones as Robotic Control Platforms - Google Project Hosting
    with this javascript code.
    ------------------------------------------------
    function onKeyDown(evt) {
    if (evt.target == speakTxt ||
    evt.target == speakCombo) {
    if (evt.keyCode == keyCodes.ENTER) {
    sendAction('speak:' + speakTxt.value);
    }
    return true;
    }
    if (evt.keyCode == keyCodes.SPACE)
    sendAction('s');
    else if (evt.keyCode == keyCodes.ARROWUP && prevAction != 'f') {
    sendAction('f');
    } else if (evt.keyCode == keyCodes.ARROWDOWN && prevAction != 'b') {
    sendAction('b');
    } else if (evt.keyCode == keyCodes.ARROWRIGHT && prevAction != 'r') {
    sendAction('r');
    } else if (evt.keyCode == keyCodes.ARROWLEFT && prevAction != 'l') {
    sendAction('l');
    }
    }
    ----------------------------------------------------
    I try to change the code from this
    else if (evt.keyCode == keyCodes.ARROWUP && prevAction != 'f')
    to this
    else if (evt.keyCode == keyCodes.ARROWUP && prevAction != 'hl')
    and it activate the 3:rd wheel but it have a very low speed.
    How am I to write (optional argument) with the 'hl' to set a new wheel speed?

    I have tried (optional argument) like 'hl' + '8' or 'hl' + 8 or 'hl+8' but no response.

    Does anybody know how to write an (optional argument) to 'hl' ???
    Here is the code info about how to use the javascript code and its argument.

    LegoNXTDocumentation.wiki - cellbots - Using Cellphones as Robotic Control Platforms - Google Project Hosting
    -------------------------------------------------
    || command {required argument} (optional argument) || argument description || argument description || notes ||
    || f (speed) || speed: '0' to '9' || || drive forward ||
    || b (speed) || speed: '0' to '9' || || drive backward ||
    || l (speed) || speed: '0' to '9' || || turn left ||
    || r (speed) ||speed: '0' to '9' || || turn right ||
    || s || || || stop the wheels||
    || '0' through '9' || a single number, '0'-'9' || || sets the default speed for f/b/l/r ||
    || w {velocity} {velocity} || velocity: "-100" to "100" || || set wheel velocities ||
    || hl (speed) || speed: '0' to '9' || || turn the third motor left (arbitrary) ||
    || hr (speed) || speed: '0' to '9' || || turn the third motor right ||
    || df {distance} (speed) || distance: in degrees. || speed: '0' to '9' || drive forward a set distance ||
    || db {distance} (speed) || distance: in degrees. || speed: '0' to '9' || drive backward a set distance ||
    || dl {distance} (speed) || distance: in degrees. || speed: '0' to '9' || turn left a set distance ||
    || dr {distance} (speed) || distance: in degrees. || speed: '0' to '9' || turn right a set distance ||
    || hdl {distance} (speed) || distance: in degrees. || speed: '0' to '9' || turn head a set distance left ||
    || hdr {distance} (speed) || distance: in degrees. || speed: '0' to '9' || turn head a set distance right ||
    || demoLineFollow || || || Follows a line ||
    || demoFindWall (distance) || distance: in cm, distance from wall to stop || || Drives until within (distance) or 20 cm of a wall ||
    || demoStop || || || Stops any in progress demo behaviors ||

Similar Threads

  1. Phone doesn't prompt for unlock code with VF sim
    By andrewharder in forum General Help and How To
    Replies: 2
    Last Post: 10-11-2013, 07:42 PM
  2. Control texting Via computer
    By Monkey Brawler in forum HTC Hero
    Replies: 10
    Last Post: 08-04-2011, 03:37 PM
  3. App Needed: Control Wifi, sound, airplane mode
    By baycruisers in forum Motorola Droid
    Replies: 2
    Last Post: 11-07-2009, 04:34 PM
  4. lost volume control
    By AndroidFTW in forum HTC Hero
    Replies: 6
    Last Post: 11-05-2009, 09:28 PM
  5. HTC Releases Kernel Source Code
    By alottabull in forum HTC Hero
    Replies: 0
    Last Post: 10-23-2009, 08:09 AM

Posting Permissions