native code for bang bang controller