My display shows the number sent thru serial terminal for about 3 seconds and then the variable is lost.
Can you post the actual code? The code you posted should work fine (apart from the obvious typo), but as I have no clue of how the rest of the code looks it's hard to locate the error