Shop OBEX P1 Docs P2 Docs Learn Events
Please Help — Parallax Forums

Please Help

karumb2karumb2 Posts: 6
edited 2006-02-24 16:31 in BASIC Stamp
Hi group,

I am new to this and I need some help asap.·Does anyone know how I can open a text file, located on the PC and then based on
a unique number in the text file get a servo motor to turn either clock wise or counter clockwise. I know how the motor is conected and all but just need to know how to open the text file and then turn the motor based on the number in the file.

For Ex, one text file contains a 1- the servo turns clockwise, and·one text file contains a 2- the servo turns counterclockwise.

Can some one please help me as soon as possible. Your help is GREATLY appriciated!
·

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-23 03:57
    The concept was covered in the following thread.

    http://forums.parallax.com/showthread.php?p=572202

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • karumb2karumb2 Posts: 6
    edited 2006-02-23 14:32
    So there is no way to open a text file using basic stamp commands?
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-02-23 14:48
    karumb2 -

    The PBASIC Stamp does not support any Windows or DOS commands, nor does it have any facility for interfacing with the Windows/DOS operating system directly. There are various methods for doing what you're looking to do indirectly however.

    You could certainly write a small Windows/DOS application, or use an existing intelligent terminal program, and communicate with it using SERIN and SEROUT. Somewhat needless to say, whatever the Windows/DOS application, it would need to be running (started) before the Stamp could begin to interface with it at all.

    Once you have the Windows/DOS application started, all that's required is for it to then "handshake" with the Stamp to establish initial communication and "prove" the communications link, then you can pass whatever information you choose to over that asynchrounous serial link. It would be the Windows/DOS program's responsibility to open the file in question, field the data, and then pass it on to the Stamp. It's not a terribly difficult task, but there is no "canned" solution of which I'm aware.

    BTW - I couldn't find anything in the prior referenced thread either <shrug>.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->

    Post Edited (Bruce Bates) : 2/23/2006 2:58:12 PM GMT
  • karumb2karumb2 Posts: 6
    edited 2006-02-23 14:53
    By Windows/DOS application do you mean something like a C program? In a compiler? I am new to programming, do you have some sample code of what you mean?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-23 15:13
    Think about what you are asking.· What kind of security would a computer have if you could just connect something to it that could take it over and run programs on it?· The PC is in control of its file system.· If you want access to that file system you need to request it through the PC OS.· Well if the PC OS isn't listening to you and doesn't know you exist (It doesn't know what a BASIC Stamp is) then you need to write a program that runs on it and does that (listens).· You could then use the programming port on the BASIC Stamp to communicate through the same serial port connection you program the BASIC Stamp through.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • neotericneoteric Posts: 144
    edited 2006-02-23 15:22
    I am pretty new to all this as well.·· But couldn't a bluetooth add-on, or even the Pink be used for a purpose of this sort?· But couldn't the Pink just go to a PC over ethernet, certain directory, and get a file?· Or get a shared file over the Bluetooth device.· No programming on the pc side....

    Post Edited (neoteric) : 2/23/2006 4:03:05 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-23 16:16
    Well that's a whole different concept because now you're talking about already having a device networked to the computer (So now it knows it is there) and the sharing the file (leaving it up to the remote device to get it over the network).· You couldn't do this by just plugging a BASIC Stamp into a computer.· That was my point.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tom WalkerTom Walker Posts: 509
    edited 2006-02-23 16:25
    neoteric,
    Using Chris's chain of thought...
    Wouldn't that mean that anyone on the Internet could just take any of your files? After all, they are "connected" to your machine in the same way that a PINK is.

    In short, you must have something running on the device that actually "has" the hard drive (in your case, a PC) that can read the drive (handle all the low-level stuff like figuring out where on the drive the file exists and directing the drive electronics to move the read/write head and get the bits) and "give" the information to the requesting device (in your case, the Stamp). This is not a difficult task, and has been covered numerous times on these fora. Start with learning something about the Stamp...the free "What's a Microcontroller?" text is a very good place to do so...and then work your way up.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • neotericneoteric Posts: 144
    edited 2006-02-23 17:00
    Chris, I was responding to Karumb.· You posted your reply while I was editing mine.· I was trying to come up with a solution for Karumb.· I certainly was not arguing security with you...· I was trying to be helpful!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-23 17:03
    Right, nobody is being offensive/defensive, I was pointing out the difference so that everyone knows how/why that may/may not work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • karumb2karumb2 Posts: 6
    edited 2006-02-24 16:31
    thanks to all of you for your help
Sign In or Register to comment.