Two Picaxe connected using erf and urf module

Puuhaaja

Senior Member
I'm trying to make car parking place radar because one parking slot is situated in a narrow place so it's hard to reverse back there. Picaxe situated in parking slot is using ultrasonic sensor and it's sending trough picaxe urf module if there is a car or not. Picaxe situated in my car is using erf module and it will tell if place is free. Now I have tried to test how this combo system works together but despite many attempts I haven't got them to work so I'm asking you if you have any idea how to proceed in this project.

PICAXE URF SENDER CODE

Code:
'URF RX to PICAXE B.7
'URF TX is Floating
'URF CTS to 0V


symbol distance = w0
symbol trigger = B.1
symbol echo = B.0
setfreq m8

main:
low b.7 'transmitter rx need to be LOW.
pulsout trigger, 2
pulsin echo,1, distance
pause 10
let distance = distance * 5 / 58
if distance > 10 then
	b2 = 1
	serout b.7, n9600, (b2)
end if

if distance < 10 then
	b2 = 0
	serout b.7, n9600, (b2)
	end if
'debug distance
pause 100
goto main


PICAXE RECEIVER CODE

Code:
#picaxe 28X2 
 
; ERF RX to PICAXE TX (C.1) 
; ERF TX to PICAXE RX (A.2) 
; ERF CTS to 0V 
setfreq m8 
low B.4     ; NB! ensure ERF RX is held low  
            ; even when not used in this program 
main: 
  serin A.2, n9600_8, (b0) 
  debug
  goto main
 

Circuit

Senior Member
I think that serin A.2, n9600_8, (b0) should read serin A.2, n9600_8, b0.
The brackets for serin are for qualifiers which are defined as "optional variables/constants (0-255) which must be received in exact order before subsequent bytes can be received and stored in variables."
 

Puuhaaja

Senior Member
Thanks Circuit fot your comment. I haven't used Picaxes for a long time and it's easy to see from that simple mistake which I made. Sad but true but that didn't helped at all. My system is not working so there's some other(s) mistakes left. Any ideas?
 

BESQUEUT

Senior Member
This is not the problem, but what happen if distance=10 ?
With DEBUG you cannot see anything if you receive only zeros...
Prefer
sertxd("B0=",#b0,13,10)
 
Top