You are basically right but there are some questions you will have to ask yourself like:
How do i turn pins off?
How can i plan my program so that it is scalable? You should be able to extend the number of pins and also restrict which pins are permittable output with a minimum of code chages
Before you have answered questions like you should refrain from writing any code. Partly because it will cause unnecessary reworking but more important, once you start to write code you will tend to stick to that solution and reject other ones.
This demo of Python and Arduino comms should help. Note the need to allow for the Arduino resetting when Python opens the serial port. And keep the serial port open until Python is completely finished with the Arduino.
I tried it and it seems to work perfectly between linux machine and arduino uno. I might add a time delay at the end in the python code, to stop it from blasting the arduino's RX pin.
davidjberman:
Thanks for your responses Shannon and Nilton!
What do you think of this solution by Cvyak?:
...SNIP...
I tried it and it seems to work perfectly between linux machine and arduino uno. I might add a time delay at the end in the python code, to stop it from blasting the arduino's RX pin.
I think you meant Robin rather than Shannon.
If it works perfectly you hardly need my opinion.
In any case why do you expect me to work on two solutions to your problem?