Hi @Gentmat
I fixed your code posting above in the way that @Moors7 suggested (thanks!). You can go back and edit posts for this sort of thing–click on the little pencil.
Unfortunately the STM032 chip on the Spark core does not have a bandgap reference so this type of self-measurement is not easy on the Spark core. You could add an external band-gap reference like the LM185/285/385 series and use the internal ADC or you could add a battery voltage IC like these:
or