New User of Pic Axe servos

Iam using the PicAxe Experimenter Board...Loaded sample codes from quick start section of manual 1..Works great...

Now Iam writing a simple code with a push switch <that is on board>..
wrote this code and simulated it with the 28x1 setting in option tab...it ran


main: ‘ make a label called ‘main’
if pin0 = 1 then flash ‘ jump if the input is on
goto main ‘ else loop back around
flash: ‘ make a label called ‘flash’
init: servo 4,75 ‘ start servo on 4
servopos 4,75 ‘ move servo to one end
pause 2000 ‘ wait 2 seconds
servopos 4,150 ‘ move servo to centre
pause 2000 ‘ wait 2 seconds
servopos 4,225 ‘ move servo to other end
pause 2000 ‘ wait 2 seconds
goto main ‘ loop back to start


tryed to program the chip by clicking program tab it asks to change to 28x2 ...now iam getting a compile error

if pin0 = 1 then flash ‘ jump if the input is on
^

Error: Unknown symbol - pin0


:confused: any suggestions
 

MPep

Senior Member
Hi,

And welcome to the Forum.

I have manual v6.9. On page 18 there are the answers you need.

When used on the right of an assignment ‘pins’ applies to the input pins e.g.
let b1 = pinsB
will load b1 with the current state of the input pin on portB.
The variable pinsX is broken down into individual bit variables for reading from
individual inputs with an if...then command. Only valid input pins are
implemented e.g.
pinsB = pinB.7 : pinB.6 : pinB.5 : pinB.4 :
pinB.3 : pinB.2 : pinB.1 : pinB.0
Change the line to
Code:
if pinB.0 = 1
That should now work for you.

Hope this helps.
MPep.
 

Technical

Technical Support
Staff member
You can also use the conversion wizard (via the PICAXE menu) to automatically change the code into 'X2 syntax'.
 
Top