Symbol issues?

fritz42_male

Senior Member
Hi guys,

Can someone explain what I'm doing wrong - I want to use sensible variable names and most of what I'm doing is working OK but just keep on getting a syntax error


Code:
#Picaxe 18M2
symbol PIR_IN=B.7
symbol PIR_COUNT=w0
		
Init:								'Staring point to setup all inputs, outputs and set variables
        debug 
	Pause 6000'0					'Wait 60 secs for PIR to 'settle down
  
 PIRtest:
	Do : Loop Until pinB.7=1
	Do
	PIR_COUNT = PIR_COUNT + 1 * pinB.7
	Loop Until PIR_COUNT = 10
	PIR_COUNT = 0
All I want to do is use PIR_IN instead of pinB.7 but it keeps telling me it's invalid syntax! e.g. D0: Loop Until PIR_IN=1

And if it looks identical to what Halstaff is doing that's because it is. We are collaborating on some Halloween stuff.
 

IronJungle

Senior Member
My first post from the iPhone app, so I hope this reply goes to the right place.

I think your issue is that "Do:" is not a valid label as it is a keyword. Try changing it to "DDo:" or something else.
 

Svejk

Senior Member
The issue is that PIR_IN is replaced with B.7 (a reference to an output). If you change

symbol PIR_IN = pinB.7

it should work as expected.
 

westaust55

Moderator
@IronJungle,
The line you are discussing is a tight loop, that is DO : (nothing) : LOOP, not a label named DO:

@Fritz
Try the line as:
symbol PIR_IN=pinB.7
 

Goeytex

Senior Member
When I load the code in the Program Editor I do not get a syntax error. What version of PE are you running?
Does it support the 18m2 ? Remove the #Picaxe 18m2 directive and see what happens.
 
Top