|
and here is the code to use the gyro as a compass heading. angle is a VAR WORD (16 bits) and it should be initialized to 32,000 or some other number in the middle of its range
'*************update auto_mode time counter and angle integration**********************
auto_time=auto_time+delta_t+1 'increment loop counter, including any missed loops
angle=angle+yaw-128 'add yaw sensor reading to angle integration
angle1: if delta_t=0 then angle2 'add yaw againg for eact count of delta_t
angle=angle+yaw-128
delta_t=delta_t-1
goto angle1
angle2:
|