Change global variables
For most purposes, a global variable is no different than any other variable. For example:

int var1;

void setup()
{
    int var2;

    var1 = 123; // global
    var2 = 123; // local
}


You can assign to global and local variables in the same way.

The only difference is that you need to be careful if you're using a global variable in an interrupt. You may need to declare it as volatile for it to behave correctly elsewhere in your code. If you don't know about interrupts then you probably don't need to worry about that though.