Feb-11-2018, 02:34 PM
As generator:
# dummy function to run the code # this function should simulate the adc read_adc = lambda x: (x + 2.6) * 1.8 def read_tmp(sensorid): return read_adc(8 + sensorid) def read_all(): for channel in range(8): yield read_tmp(channel) # you define outside of the function which # container object you create all_sensor_data = list(read_all()) # the generator read_all() iterates until it's exhausted # it's consumed by list print(all_sensor_data)
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!