PICAXE 28x1 Syntax Error

I need help, I'm trying to program a sonar with the PICAXE programing editor and tere's this Syntax error that shouldn't be there.

low portc 0
pulsout b.5,5
pause 200
pulsin portc 0, 1, w1
w1 = w1/29

It only complains with the "pulsin" line, the "low" line doen't create any sort of problems. What's wrong here?

there is a space between

there is a space between your “0.” and the following “1.” get rid of that :slight_smile:

 

sorry, shot my RE off too soon

try this:

low portc 0
pulsout b.5,5
pause 200
pulsin 0,1,w1
w1 = w1/29

Just wanted to add

I’m betting the low command is for demonstration only but it will turn your c.0 pin into an output. Port C pins start as inputs on powerup. You’ll need a DIRSC command before your PULSIN to set it as an input again.

Also, I’m not sure which sonar you’re using but a 50us activation pulse is pretty long. Most require around 10us. The following “pause 200” is not necessary. That’s almost a quarter second delay. You really want the PULSIN command to be fired up as soon as possible to catch close range objects.

Let us know how it goes.