Shop OBEX P1 Docs P2 Docs Learn Events
send data from a c++ program to basic stamp 2 program dynamically — Parallax Forums

send data from a c++ program to basic stamp 2 program dynamically

GrishmaGrishma Posts: 9
edited 2014-11-25 11:09 in BASIC Stamp
I want to know how to send data(float) from a c++ program to a bs2 program .In other words, how to read data from a c++ program to a bs2 program dynamically, using commands.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-11-25 08:33
    Hello,

    You're probably going to need more details. For example, where is the C++ program running? PC? Another MCU? As far as the BASIC Stamp 2 is concerned data can be received serially.
  • GrishmaGrishma Posts: 9
    edited 2014-11-25 08:48
    Hello,

    You're probably going to need more details. For example, where is the C++ program running? PC? Another MCU? As far as the BASIC Stamp 2 is concerned data can be received serially.


    The C++ program runs in pc.Basically I have a program in c++ that calculates a value(float).Now I need to transmit this value to a bs2 program(running on PC (xp) with in built Bluetooth) so that it instructs a boebot to travel that much distance through Bluetooth (eb500).I suppose that now my idea is clear to you. My modules in c++ and bs2 are ready I just need to interface the data from one code to the other.
    Or Is there a better alternative available to perform this whole task??
  • PublisonPublison Posts: 12,366
    edited 2014-11-25 08:53
    You already have a thread running with these questions:

    http://forums.parallax.com/showthread.php/158236-how-to-send-data-through-PC-to-boebot-using-eb500-bluetooth?p=1303394#post1303394

    I have deleted two other cross posting violations in the past week.

    Keep to to one thread please.
  • Mike GreenMike Green Posts: 23,101
    edited 2014-11-25 10:57
    There are too many PCs involved or too many PC programs. Also, a BS2 program runs on a BS2 which is part of your BoeBot (Stamp Board of Education). As far as the Stamp is concerned, the EB500, once configured, just looks like a wired serial connection to something. To a PC program, the built-in Bluetooth looks like a wired serial connection to something, in this case, the EB500. Your C++ program just needs to open a COM port using the standard C++ libraries and transmit the data using standard C++ calls. The BS2 will see the serial data stream and can process it using SERIN. Note that the Stamp doesn't deal in floating point. It works only with integer values (from -32768 to 32767 in value). You'd have to convert your floating point values to some kind of meaningful integer values either on the PC or on the BS2 ... PC is easier.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-11-25 11:09
    Thanks Publison. Locking this thread and deferring replies to the one you linked.
This discussion has been closed.