from __future__ import print_function import math BRIGHTNESS_LEVELS = 64 print("// Generated by LogCurveGen.py") print("PROGMEM const static uint8_t ledLogCurve[] = {", end='') for i in range(BRIGHTNESS_LEVELS): # newline every 8 if i % 8 == 0: print("\n\t", end='') if i == 0: mapped = 0 else: mapped = int(math.log(i,BRIGHTNESS_LEVELS-1) * BRIGHTNESS_LEVELS) # map to the different order in the board print('{}, '.format(mapped), end='') print("};")