# [CentralOH] (no subject)

Louis Bogdan looiebwv at gmail.com
Sun Dec 8 20:36:01 CET 2013

```I will start out by saying,"Have you heard that a LITTLE bit of knowledge
is a dangerous thing?"  Well, I am the Poster Boy for that saying.

num is calculated value 1.2346
a=num(-1) is indicating the numeral "6" with negative indexing notation.
b=num(-2) is indicating the numeral "4"   "         "
"              ".

if numeral "6" is greater than "7" make numeral "6" a "0" and increment the
"4" to "5".
elif numeral "6" is less than"3", meaning a "0", "1", or "2", make it a "0".
else none of the above conditions apply, make numeral "6" a "5".

EXAMPLE: 1.2340, 1.2341, 1.2342 become 1.2340
1.2348, 1.2349 become 1.2350
1.2343, 1/2344, 1.2345, 1.2346. 1.2347 become 1.2345.

So with the "Bogdan" rounding, I am never more than .0002" off calculated
position.
I then divide the modified num 1.2345 by .0005 and get 2469 which is the
number of steps required of the stepper motor to provide a movement of
1.2345" (-.0001" from theoretical.)

I hope that explains MY way of talking to a computer.  How would you talk
to Python and say the same thing and Python says,"MAN, I know what you
want!?  Lou

On Sun, Dec 8, 2013 at 11:34 AM, Andrew Fitzgerald <
andrewcfitzgerald at gmail.com> wrote:

> Hi Lou,
>
> Could you perhaps provide a summary of what that code is supposed to do?
>
> Right now you're assigning num the numeric value 1.2346 on the first line.
>
> You're then attempting to call num as a function on the next 2 lines.
>
> This won't work because num hasn't been defined as a function anywhere,
> and if it was the function is overwritten by the value 1.2346 on the first
> line.
>
>
> The part below that (if/else) looks like it should work if a and b are
> assigned numeric values.
>
> -Andrew Fitzgerald
>
>
> On Sun, Dec 8, 2013 at 11:09 AM, Louis Bogdan <looiebwv at gmail.com> wrote:
>
>>  Hi folks @central oh/python:
>>
>>
>>
>> As a recent subscriber, I received notice of your Dec 9 meeting from
>> Brian.  As I am working on a program to go along with a recently filed
>> patent, and am totally new to Python, I sent him a proposed “subroutine”.
>> This is used repetitively within the program.  Since I sent it to Brian,
>> I have done some more research and have come up with a better version as
>> follows:
>>
>>
>>
>> num = 1.2346
>>
>> a = num(-1)
>>
>> b = num(-2)
>>
>> if a >7:
>>
>>      a = 0
>>
>>      b+ =1
>>
>> elif a<3:
>>
>>      a = 0
>>
>> else:
>>
>>       a = 5
>>
>>
>>
>> As each stepper motor step equals .0005” of movement, with the above I
>> can get .0002” absolute positional accuracy with a .0005” control
>> increment. I have looked at some of the Python “round” statements and
>> examples and don’t fully understand them so as an “ole” retired engunear,
>> (does 93 qualify me) I thunk up my own way of doing things.  Maybe some
>> of you young ones can teach an ole man how to do things better.
>>
>>
>>
>> This routine also has application in several other projects I have under
>> consideration. Would something like this, if it works, be a Python library
>> item?
>>
>>
>>
>> If any of you can “tweek” the above into working order I would appreciate
>> it.  I do have some other questions for you.  What do I need to buy to
>> get started with RPi?  I will be using my Apple computer.
>>
>>
>>
>> Thank you for any comments you might have.  Lou Bigdan
>>
>>
>>
>>
>>
>> _______________________________________________
>> CentralOH mailing list
>> CentralOH at python.org
>> https://mail.python.org/mailman/listinfo/centraloh
>>
>>
>
> _______________________________________________
> CentralOH mailing list
> CentralOH at python.org
> https://mail.python.org/mailman/listinfo/centraloh
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/centraloh/attachments/20131208/da625aca/attachment-0001.html>
```