Reading sensor data, massaging it and performing operation based on transformed data This is the outline of my project:


interpret environment data (sensor, motor, etc..).
Modify this data into a more usable form,
send it back to the same motor for further operation from modified data.


As an example (this is not the project, but just an example to make sure I am being clear).

A motor moves a conveyor belt with various size flasks on it, some large other small. Depending on the reading of the position of the motor (from encoder) another process (filling the flasks) will take place.  If the first motor encoder data indicated the flask was small then the amount of liquid poured will be small. If large, the amount of liquid dispensed will be large.

More generally, read the location of an item based on motor encoder feedback.  Modify this data. Send this modified data back to a different motor so that it does something specifically as a function of the first motor encoder data.  

I am able to send the original encoder feedback to a file, manually massage it and paste it into an Arduino script, compile and have everything work great. I just want to remove the manual steps (cut &amp; paste) and data massaging (I'm looking to an Arduino program to do that).

To further complicate things, I want this process to be part of a distributable package that does not require further compiling. Reading from a sim card is fine.  Also, I am not too price sensitive as the Arduino is a small portion of the total cost of the final product.

I hope someone can give me some insight or pathway to a solution.
All the very best, John.
Here's a back-of-envelope sketch, off the top of my head:

Conveyor belt driven by stepper motor, controlled by the Arduino.  Each step is a known distance.

Bottles are either of exactly two heights, at random.  Two beam break sensors, one to determine where a bottle starts and one to determine whether it's tall or short.

Some sort of valve to control the water flow - I presume you have some idea how this can be controlled.  I don't, but washing machines have electrically-controlled valves so something broadly along those lines.  Controllable on/off by the Arduino.

Software on the Arduino steps the motor until it sees the start of a bottle (first beam broken).  Then uses second beam to determine whether the bottle is large or small.

Arduino switches on the water valve (outlet positioned exactly right to be above the bottle) for either 2s or 4s accoriding to bottle size, then off again.   (Water pressure and flow rate regulated independently, perhaps fed from a header tank).

Arduino steps motor more until it sees another bottle.



No string concatenation in there, nor sorting of lists or need for a Raspberry Pi.  It's not clear to me why you'd need those things for the application described.

I'm not aware that you can program the Arduino in Python unfortunately.  Someone may know better.  C isn't hard though - get an Arduino and some LEDs or whatever, go through some tutorials, you'll get the hang of it.