This program creates an execution routine that basically works by: when connecting a USB drive to the device's USB port, the user will only needs to wait for an automatic copy of all the data collected by the device in .csv format. In order to have access to the data quickly when he has physical access to the machine and that it is not necessary to have access to the internet.
The script save.sh
performs this backup once, exactly at the moment you execute it, as an example of the continuous operation of the software.
Create a .env file and set the enviroment variables needed, for example:
FILE_PATH = ./temp/google_stock_data.csv
SERIAL_PORT = 'COM1'
DEBUG = 1
Create a __main__.py
file in this directory:
import export as export
from config import config as env
backup_thread = export.USBListener(thread.new_drive_signal)
if __name__ == "__main__":
payload = {} #your json dict
backup_thread.start()
print("Waiting for USB connections ...")
export.write_data(payload)
Start the script creating a background proccess:
$ python3 __main__.py &
Pip will install all the libraries required by the following command:
$ make install
Or simply:
$ pip install -r requirements.txt
In order to generate a package ready for execution and loading on the desired device, we recommend that you use the build command:
$ make build
$ make tests
This command will execute the build product file generated by the build command:
$ make run
Or simply run the good old build & run:
$ python setup.py install && python firmware.py
Start the script creating a background proccess:
$ python usb.py &