TL;DR EDIT: to clarify this question and why it's relevant to the PI:
what is the most efficient way in term of absolute time and energy (which I guess is more related to clock cycle) to now the value of a GPIO pin (let say for a one wire sensor but same with simple GPIO etc...)?
f = open('/sys/bus/w1/devices/28-00000123456/w1_slave', 'r') lines = f.readlines() # read the device details print(lines)
Original question below:
It's been some time that I am playing around with some raspberries and I usually do whatever I want with simple bash scripts, mainly because I am used and feel comfortable with
grep... But I may be wrong doing so.
Thus, I was wondering if there are any reasons to use python , other than that it as "A large community supports and uses the Python language as it is easy to learn and code".
For example, to read a sensor or activate a GPIO I use to
echo the files in
/sys/class/gpio/. But maybe the python libraries are better optimised to do so?
That maybe a naive question but I am curious and willing to change my habits if they are bad (and more if it can save a few CPU calls and energy).