Hi There!
For win.callOnFlip, you need to call the function slightly differently the first argument would be the name of the function and the second would be the input to the function i.e.
win.callOnFlip(port.write, [trigger_values_hab)
regarding the second point - I am not sure about that - have you tried with values other than 1, 2, 3 ?
Becca