Hi guys ! I’m new to this forum and to Arduino altogether, so please bear with me. I need some help for an ongoing project. I have 8 pins on my Arduino from which i am getting digital reads (so either HIGH=1 or LOW=0). I would need to import those readings in Python, so that i can do something like this :
if pin1=1 then value1=1 else value1=0
if pin 2=1 then value2=2 else value2=0
if pin3=1 then value3=4 else value3=0
and then get a final value by adding them together total = value1 + value2 + value3+….
and do some other stuff, like retrieving line[total] from a text file and so on…
But I don’t really know how to go about getting the results from the digital reads in Python, I checked a bit around, and it seems like I could import the serial from the arduino, but then I would loose the relation between the pin and the pin state (wouldn’t I ?), and I would need to reassign them… And that sounds like quite a bit of trouble for something that feels pretty simple and straightforward to me.
Any advice would be very welcome ! Thanks !