Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Take-Home-Test Client

(Accelerometer data reader/plotter)

This python script connects to the thtest (Take-Home test server) application on TCP port 5678

The script reads accelerometer samples and plots each on a rolling graph

The script handles TCP disconnects and reconnects gracefully if the server stops and restarts, etc.

The script logs (rolling log) raw sample data to thclient.log, limiting size to 5MB

Prerequisites

To run this program you will need python3 and the package matplotlib (others needed will usually be installed already on most systems)

Running

python3 thclient.py

That should open the plot window. Then hit the Start button to start data production on the server When running the button text changes to Stop and hitting that will stop data production on the server

Command line

You can start the script with the following arguments:

usage: thclient [-h] [-s HOST] [-p PORT] [-a]

options:
  -h, --help            show this help message and exit
  -s HOST, --host HOST  data server hostname
  -p PORT, --port PORT  data server host port
  -a, --autostart       start collecting immediately

The default HOST is localhost (127.0.0.1) and default PORT is 5678

The autostart switch just tells the server to start production on connection without waiting for a button press

Implementation notes

The core plotting code (guts of update_plot) were culled from the internet, perhaps AI generated. The rest of the script (TCP/logging/classes/main/etc.) were done by hand with internet help for reference.

Example output

Examples of the plotting, logging, and run-time experience are saved under example_output under this directory

See the README.md there for more information

About

TH client

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages