Difference between revisions of "Python Smart Terminal"

From OpenCircuits
Jump to navigation Jump to search
Line 1: Line 1:
 
This page is a very early draft, somewhat my notes as I go alogn
 
This page is a very early draft, somewhat my notes as I go alogn
 +
 +
= What/Why =
 +
 +
[[http://www.instructables.com/id/Python-Terminal-for-Cheap-Pi-Arduino-Connection/ Python Terminal for Cheap Pi Arduino Connection]]
 +
 +
  
 
= Installation =
 
= Installation =

Revision as of 17:24, 22 September 2016

This page is a very early draft, somewhat my notes as I go alogn

What/Why

[Python Terminal for Cheap Pi Arduino Connection]


Installation

This program is intended for those who at least occasionally develop in Python. I expect that they already run some things in Python and will just add this as an additional project. There is no install program you just download the files, place where you keep your projects and run. A bit more later in this section.

Before you begin to install you should know a bit about the environment that I have used to build, test and run the terminal. If your environment differs too much you may have trouble getting it to run.

I run Python mostly using the install that comes with Anaconda Spyder and often use the IDE it installs. This is not necessary, it is just an nice install that downloads a lot of stuff that technical folks find useful. I have use conda an pip to add to this install and do not know offhand all that is in it. It is Python 2.7. You can look at the include statements to get some idea of what you might need to add. Or you can just keep running it and add the packages it complains about.

Download the files ( I have not decided just how they will be on git hub in at least one form ) Uncompress if they are compressed. The directory structure should looks like this

         whatever --|
                    |-- rshlib
                    |
                    |-- SmartTerminal

Put them in your system making whatever anything convenient for your Python. It should run ( at least to put up its GUI ) by running smart_terminal.py. Note that there may be a certain amount of left over, dead code, in the directory I am cleaning out bit by bit, someday it may be nice and neat. For now if you want to tinker look at the design info below first.

Run it until it stops complaining about dependencies ( in the console ), after that ( and perhaps even before ) the GUI should come up. You are installed.


I have run the program on both Windows 10 and Rasperian on a RPi. It should work in most OS's. Let me know about issues.

Some parts of the program think that mySql is available. It should run fine without it ( there will be a message or two in the console ), untill you try to use the database then it is not so gracious. Straight ahead use as a terminal does not use the database.

Configure to Run

Basic configuration of comm parameters like port, baud rate .... is all done in a file called parameters.py. It seemed easier to simply use a Python text file instead of some other format like an ini file. Pretty much all the file does is set instance variables in itself. It is used by the program controller ( smart_terminal.SmartTermianl ) to create an instance of Parameters and then the values can be used. Save the original ( maybe I will include a backup maybe not ) in case you mess it up too much.

Parameters starts out with some "meta" parameters. These are defined early in the creation of the objects and may effect other values. In any case you can always define a value twice, the last one always wins.

All the com port values are defined in pretty much one place, find it an change it to what you need.


Notes on the Code

In some ways I am proud of the code, it was sometimes a slog, and I had to learn a lot of Python to get it going. On the other hand it kind of sucks, it has lots of dead code, ass backwards was of doing things, poor naming...... Until I loose interest in it it will probably improve. However adding features is more part of the life of a programmer, making something better that seems good enough is not always the priority it should be. If you do not like it, mostly keep it to yourself unless it is accompanied by an offer to improve it. I do not need ideas, I need time.

Design

These notes are here so you can change what you do not like. Contact me Russ Hensel if you need additional help.