pyboard work flow

How to interact with the pyboard?
I develop using Linux Mint and Eclipse running the pydev plugin. Initially, to display and interact with the pyboard, I made a slight modification to the pyterm script from this page. I changed line 27 so that screen is used instead of minicom. This will open a REPL to interact with the pyboard. However... I now use CoolTerm to interact with the pyboard. Why? I found that with the screen interaction, I had to exit the screen and physically disconnect and reconnect the pyboard before I could read data coming from it through the USB cable and one of the ACM ports. When I look at the data in CoolTerm, I can click the 'Disconnect' button at the top of the program and the data coming through the ACM port is immediately visible to the python scripts I am running to use this data. 

Top tip: I had to use 

sudo apt-get install libicu52:i386 

to get CoolTerm to work with Linux Mint.

  1. find pyboard and open a terminal
  2. from
  4. '''
  5. #!/usr/bin/python
  6. import sys
  7. import os
  8. import fnmatch
  10. """
  11. Usage: pyterm [device]
  12. Calls screen on "device". If device is not given, looks for /dev/ttyACM* devices
  13. (the name of the pyboard under Linux) or /dev/tty.usbmodem* devices (name of the
  14. pyboard under MacOS).
  15. """
  16. def main():
  17.    if len(sys.argv) > 1:
  18.        ttymodems = [sys.argv[1]]
  19.    else:
  20.        ttymodems = fnmatch.filter(os.listdir('/dev'), 'ttyACM*')
  21.        if len(ttymodems) == 0:
  22.            ttymodems = fnmatch.filter(os.listdir('/dev'), 'tty.usbmodem*')
  23.        if len(ttymodems) == 0:
  24.            print('Error: no pyboard found.')
  25.            sys.exit(1)
  26.        ttymodems[0] = '/dev/' + ttymodems[0]
  27.    os.system('screen '+ttymodems[0])
  29. if __name__ == "__main__":
  30.    main()

The CoolTerm window below shows some accelerometer data coming from an MPU6050 connected to a pyboard v1.0. Each line of data shows a scan of accelerometer data. The data is of the format:
START counter x_acc y_acc z_acc END
I used ctrl-c to stop the script running. I could then edit the files on the pyboard using Eclipse running pydev. After saving the changed files on to the pyboard, I use ctrl-d to do a soft reboot and start the modified script. As soon as I click on 'Disconnect' at the top of the CoolTerm, any data being sent through the ACM port can now be accessed, for example by a python script which uses the data to generate graphs of the accelerometer values.

CoolTerm showing data from the pyboard