You are setting up a local (automatic) variable event
in setup()
and expose its fields, but once you leave setup()
event
will cease to exist and hence your Particle.variables()
will refer to mem locations that no longer refer to the values you had located there before.
You need to declare event
in global scope.
The names you use in your "readable" code are absolutely irrelevant for the actual machinge code.
Imagine you call the two event
variables you are declaring once eventSetup
and eventLoop
(denoting their respective scope) and re-read your own code. This should make clear what I meant above.