viernes, 2 de mayo de 2014

Picaxe project board and programming

I've used a 28 pin picaxe board for this project. Here you have its datasheet:
http://www.picaxe.com/docs/axe020.pdf

In the outputs pins I've connected the three LEDs, the servo and the display.
In the analogue inputs I've connected the three digital sensors of distance, and I've connected the push-button at one of the digital inputs.

These connections are simple, but let's see how to program it.

let b3 = 0
setint %10000000,%10000000 ‘ activate interrupt


inici:
let b4 = b3
let b3 =0
if pina.1=0 then
  high b.7
  inc b3
end if
if pina.2=0 then
  high b.4
  inc b3
end if
if pina.3=0 then
  high b.3
  inc b3
end if
if b3=b4 then
goto inici
end if
low b.7
low b.4
low b.3
if b3=0 then
serout B.5,N2400,(254,1)
pause 30
serout B.5,N2400,(254,128) ; move to start of first line
serout B.5,N2400,("3 spaces left") ; output text
end if
if b3=1 then
serout B.5,N2400,(254,1)
pause 30
serout B.5,N2400,(254,128) ; move to start of first line
serout B.5,N2400,("2 spaces left") ; output text
end if
if b3=2 then
serout B.5,N2400,(254,1)
pause 30
serout B.5,N2400,(254,128) ; move to start of first line
serout B.5,N2400,("1 space left") ; output text
end if
if b3=3 then
serout B.5,N2400,(254,1)
pause 30
serout B.5,N2400,(254,128) ; move to start of first line
serout B.5,N2400,("Any space left") ; output text
end if
goto inici


interrupt:

if pinC.7 = 1 then interrupt ; loop here until the
; interrupt cleared

servo 6, 130
pause 5000
servo 6,210
pause 500
setint %10000000,%10000000 ; re-activate interrupt

return ; return from sub

This is all for today, later I'll upload the video showing how the parking works,


jueves, 1 de mayo de 2014

Presentation

Welcome everybody, this blog is going to be about the world of PICAXE. PICAXE chips are popular because they are very low-cost, and simple to program using free, easy-to-learn software. This is an automated parking I've built with PICAXE components. There are four places and three of them have a digital sensor of distance. There is a push-button at the entrance which activates the barrier. The LCD display shows how many places are avaiable. There are 4 LED, one for each place and the barrier is a servo.