Shop OBEX P1 Docs P2 Docs Learn Events
Code Help — Parallax Forums

Code Help

HatemHatem Posts: 20
edited 2008-03-28 00:28 in BASIC Stamp
Hello guys … how do I write the following:
·
IF (Angle2 - Angle1) < (0.05*Angle1) THEN
··········· GOSUB Forward_Pulse
·
It is not liking the 0.05*Angle1 part of the code. The·error says.. ·Expected a binary operator or ')' .. ·Is there a way to tell it that if it's within 5% of Angle1 then move on???


angle·········· ·VAR···· Word·············· ' Angle measurement for Compass
Angle1········· VAR···· Word·············· ' Angle Reading before Detecting Object
Angle2········· VAR···· Word············ · ' Angle Reading after Detecting Object
·
· angle = x ATN - y························ ' Convert x and y to brads
·
· Angle1 = angle */ 360·················· ' Convert brads to degrees
·
· Angle2 = angle */·360·················· ' Convert brads to degrees

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-03-28 00:28
    IF (Angle2 - Angle1) < (0.05*Angle1) THEN GOSUB Forward_Pulse

    IF (ANGLE2 - ANGLE1) < (ANGLE1 / 20) THEN GOSUB Forward_Pulse
Sign In or Register to comment.