Update main.c

speed is a global variable