Close



Results 1 to 10 of 72

Threaded View

  1. #11
    Engineer-in-Training
    Join Date
    Oct 2013
    Posts
    219
    peachy2.jpg
    Have completed the PICAXE version of the light switch. All of it is completely alterable by changing the software. Runs great in the simulator................ it's a dynamic simulator and altering the LDR above and below a threshold switches the relay on and off alternately. Pushing the mode select push button turns the relay OFF and generates a nice little square wave which would drive the mirrors for scanning. Pushing the button again, puts it back into drip-valve mode. The PAUSE statements in the software will need altering to suit the real setup. The chip is programmed using a serial link. The transistor and relay can be replaced with a FET switch circuit of your choice. The software follows:-

    low 0 'initialise outputs to OFF
    low 4
    main:
    readadc 1, b1 'read value on pin 1 into variable b1
    if b1 > 100 then 'if laser pointing at LDR
    pause 1000
    goto onoff 'turn the drip valve ON
    endif
    if pin3 = 1 then ' if button pressed scan-mode required
    goto scanmode
    endif
    goto main

    onoff:
    high 2 'turn transistor ON
    readadc 1, b1 'check if laser is demanding OFF
    if b1 > 100 then 'only exit this loop if laser fires again
    pause 1000
    low 2 'turn transistor OFF
    goto main
    endif
    goto onoff ' back around if no OFF signal from laser

    scanmode:
    pause 2000 'wait to prevent bounce
    low 2 ' make sure drip valve is OFF
    high 4 ' set mirror squarewave drive on pin 0
    pause 100 ' alter this to suit the mirror slew rate
    low 4 ' mirror square wave 0
    if pin3 = 1 then
    pause 1000
    goto main 'exit scanmode if mode pushbutton pressed
    endif
    goto scanmode
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •