Search code examples
bluetoothmacrosttlteraterm

Send cyclic command to serial port


I have to execute some tests with a Bluetooth LE module. For the BT Chip I have an evaluation board here, which I can connect via USB to serial port on my PC.

From the manual of the eval board I learned how to broadcast data from the BT chip using Tera Term. It is just a simple command like "SHW, 0018, AABBCCDD" I have to type in and the BT module will send this data.

Now I want to automate Tera Term, so that this command is executed every 100ms. I did some research and I know that I have to use the Tera Term macro language (TTL?), but I'm really not into this program.

Can anybody help me out here with a code snippet or a link to the right explanation? I think, it should be pretty easy?

Additional info: I connect to the eval board on USB Serial Port (COM7) with baud rate 115200.


Solution

  • This should do the job:

    while 1  
      sendln 'SHW, 0018, AABBCCDD'
      mpause 100
    endwhile
    

    Save it as eg test01.ttl and load it in teraterm like this:

    enter image description here

    Also, here you can find a description of TTL commands.

    My opinion though, is that you should start using Python and PySerial to handle this kind of tasks.