your prg as provided does nothing with the "Z" reading
the term you have designated as azimuth is derived from azimuth = x ATN -y ie an " x " and a " y " reading , these readings are a vector (rectangular co-ordinates) the ATAN function gives you the (polar ) direction of the vector in radians where 0-255 corresponds to 0-360 degrees , so to get a degree reading the
degr = brads */ 360 scales the atn result to degrees
z is right out and your variable names aren't strictly meaningful
Bookmarks