using python for a small ADC-interface
This week’s assignment was to write an application that interfaces with an input and/or output device.
Considering the available time this week where I have to plan already ahead for the final project (such as materials and parts needed) I wanted to focus especially on one programming language enabling me to write small interface programs and to explore from there.
Python as weel as and Java Script came into my closer consideration; since I had used now some python files already without really having a closer look inside, and in addition I learned that it is very helpful to explore the possibilites of this language, I decided for the first.
For the input-device week I did an ADC-converter, whereby until today I checked the proper functioning by using Neil’s rx.py program and measuring a calibration curve. However, now I wanted to visualize the readout; this should enable me to measure the generated voltage output from my tiny hydro generator - which is the core of my final project. In doind this, I will not need any additional equippment.
So I had a closer look at Neil’s rx.py as well as the hello.light.45.py program for a start; the goal was to understand them and to combine them so that the serial byte on the serial (comming from the hello.button board which is functioning as an on demand adc converterserial) gets read and then the voltage can be calculated and displayed.
Since I did some object-oriented programming many years ago (that time using Delphi), the related syntax-conventions (with methods passed on from parents-object) was some kind of familiar to me. However, I spend some time to look up the functions of the respective methods used.
the python program
figure 1 shows my small modified python program entitled adc45interface; Just a view words to the syntax: