Shop OBEX P1 Docs P2 Docs Learn Events
Store variables in boebot — Parallax Forums

Store variables in boebot

filurfilur Posts: 5
edited 2005-03-13 20:25 in Robotics
Hello
I was just wondering if theres any way to store a variable in the boebot. For example; When the boebot moves forward the variable "a" increases by 1 on every pulse. Is there any wat to let the robot drive unconnected to the serial port, then connect it when the drive is complete, and make it debug the value of "a"? Hope you understand what i mean! Thanks in advance.

// Johan

Comments

  • Steve JoblinSteve Joblin Posts: 784
    edited 2005-03-13 15:56
    Do you mean the following?

    1.· Connect the PC and the Stamp via Serial or USB Cable

    2.· Download a program to the stamp

    3.· Disconnect the cable

    4.· Run the program (which will store a value of a variable)

    5.· Reconnect the cable

    6. Have the program send the value of the variable to the PC via the "debug" command.

    I haven't done it, but it would be easy enough to try.··You could use a switch to let the program know when to run the "debug" part of the program.·
  • filurfilur Posts: 5
    edited 2005-03-13 16:06
    Yes that's what i mean. I got another question as well: what is the speed of the robot when your using the "PULSOUT 13, 850" and "PULSOUT 12, 650" without pauses? My goal is to store the variable to see how faar the robot has driven. Any tips? Thanks
  • kelvin jameskelvin james Posts: 531
    edited 2005-03-13 18:08
    The stamp will reset when re-connecting the serial cable, thus you will lose your ram variables. You can use the WRITE command to store the variable for future reference, after the stamp has been shut down. eg. WRITE 10 (data location) ,a (data)
    Add READ and DEBUG into the program to view the data on your computer later.
    Just be careful not to put WRITE in a loop, otherwise you will exceed the amount of write cycles of that data location, for the type of stamp you have. The BS2 will take 10 million, but if you have it writing in a loop, it could be used up quickly. Put it at the end of of your program, after the main operations have been completed.

    kelvin
  • filurfilur Posts: 5
    edited 2005-03-13 20:25
    Thanks a lot kelvin
Sign In or Register to comment.