Can anyone help me with replacing the random value with the decimal value of the tag read here:
rc522_spi: cs_pin: GPIO9 on_tag: - rtttl.play: rtttl: !lambda |- return id(songs)[int(rand() % 26)].c_str();
I’m guessing I need to use the x value. But the tags are for example: 6A-65-19-BC so the - needs to be removed first before doing a hex → dec.
6A-65-19-BC
-
All attempts so far has just resulted in errors.
!lambda 'return x;'
What are trying to do with dec? 6A-65-19-BC in dec would be 106-101-25-188. What’s the point?
To make sure the same tag plays the same song every time without having to hardcode every hex possible. So by converting it to decimal and doing modulo 26 I get a song from every tag whatever the uid is. That is also why I need to remove the -