There is a library linked in this article which does almost exactly what you need: https://learn.sparkfun.com/tutorials/teensyview-hookup-guide