Help needed! Laser scanner
andy_con
Posts: 53
Hello i am a newbie and this is my first post. Hello to all
Now i know nothing about programming at all!! which is a real problem with the project.
I have made this http://lasers.musicfoxaudio.com/byoshow.htm·and its all working.
but i dont know how to code it, i have copied boomdogs code http://lasers.musicfoxaudio.com/byoshow3.htm·and tweaked it to fit mine.
this is my code for a simple X Y movement -
' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word
cycle VAR Byte
'Do not change the following lines (Calibration and settings)
'**************************************************************************
cycle=32767
GOSUB calibrate
'**************************************************************************
cycle=30
DO
GOSUB MXHigh
GOSUB MYHigh
GOSUB MXLow
GOSUB MYLow
LOOP
Calibrate:
FOR counter = 0 TO cycle
GOSUB MXHigh
NEXT
FOR counter = 0 TO cycle
GOSUB MYHigh
NEXT
FOR counter = 0 TO cycle
GOSUB MXLow
NEXT
FOR counter = 0 TO cycle
GOSUB MyLow
NEXT
RETURN
MXHigh:
HIGH 3
FOR counter = 1 TO cycle
PULSOUT 4,1
NEXT
RETURN
MXLow:
LOW 3
FOR counter = 1 TO cycle
PULSOUT 4,1
NEXT
RETURN
MYHigh:
HIGH 1
FOR counter = 1 TO cycle
PULSOUT 2,1
NEXT
RETURN
MYLow:
LOW 1
FOR counter = 1 TO cycle
PULSOUT 2,1
NEXT
RETURN
Now what document can i read to help me out with learning coding???? Also a problem people keep telling me is that the pots turning the signal into digital which is causing a problem. Im really stuck and need help
Now i know nothing about programming at all!! which is a real problem with the project.
I have made this http://lasers.musicfoxaudio.com/byoshow.htm·and its all working.
but i dont know how to code it, i have copied boomdogs code http://lasers.musicfoxaudio.com/byoshow3.htm·and tweaked it to fit mine.
this is my code for a simple X Y movement -
' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word
cycle VAR Byte
'Do not change the following lines (Calibration and settings)
'**************************************************************************
cycle=32767
GOSUB calibrate
'**************************************************************************
cycle=30
DO
GOSUB MXHigh
GOSUB MYHigh
GOSUB MXLow
GOSUB MYLow
LOOP
Calibrate:
FOR counter = 0 TO cycle
GOSUB MXHigh
NEXT
FOR counter = 0 TO cycle
GOSUB MYHigh
NEXT
FOR counter = 0 TO cycle
GOSUB MXLow
NEXT
FOR counter = 0 TO cycle
GOSUB MyLow
NEXT
RETURN
MXHigh:
HIGH 3
FOR counter = 1 TO cycle
PULSOUT 4,1
NEXT
RETURN
MXLow:
LOW 3
FOR counter = 1 TO cycle
PULSOUT 4,1
NEXT
RETURN
MYHigh:
HIGH 1
FOR counter = 1 TO cycle
PULSOUT 2,1
NEXT
RETURN
MYLow:
LOW 1
FOR counter = 1 TO cycle
PULSOUT 2,1
NEXT
RETURN
Now what document can i read to help me out with learning coding???? Also a problem people keep telling me is that the pots turning the signal into digital which is causing a problem. Im really stuck and need help
Comments
Now how do i get the Y mirror to move up and down very very slowley, so it moves the liquid sky up and down the y mirror whilst doing the effect???
' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word
counter2 VAR Word
counter3 VAR Word
timer VAR Word
effecttime VAR Word
cycle VAR Byte
dir VAR Byte
maxcycle VAR Byte
effectnumber VAR Byte
'This code was developed by Colin McCloy, a.k.a. BoomDog. If you have any questions,
'you can message me at the forum at WickedLasers.com or email me at mccloy.13@osu.edu
'Do not change the following lines (Calibration and settings)
'**************************************************************************
cycle=32767
GOSUB calibrate
cycle=25
dir=1
counter2=1
counter3=1
timer=0
effecttime=50
effectnumber=1
'**************************************************************************
'Effects:
' 5.EFFECTShrinkSky
DO
SELECT effectnumber 'Will execute the case that is currently in 'effectnumber'
CASE 5
effecttime=50
GOSUB EFFECTShrinkSky
ENDSELECT
'The following changes effects and monitors time on current effects
timer=timer+1
IF (timer=effecttime) THEN
timer=0
effectnumber=effectnumber+1
IF (effectnumber>7) THEN
effectnumber=1
ENDIF
ENDIF
LOOP
'Calibration pushes the mirrors to maximum cycle to ensure consistant results
Calibrate:
FOR counter = 0 TO cycle
GOSUB MXHigh
NEXT
FOR counter = 0 TO cycle
GOSUB MYHigh
NEXT
FOR counter = 0 TO cycle
GOSUB MXLow
NEXT
FOR counter = 0 TO cycle
GOSUB MYLow
NEXT
RETURN
'Liquid sky that shrinks in width to a single beam, and then rapidly expands again.
EFFECTShrinkSky:
IF(dir=1)THEN
cycle=cycle+1
ELSE
cycle=cycle-1
ENDIF
IF(cycle>20)THEN
dir=2
ELSEIF(cycle<5) THEN
dir=1
ENDIF
GOSUB MXHigh
GOSUB MXLow
GOSUB MXHigh
GOSUB MXLow
GOSUB MXHigh
GOSUB MXLow
GOSUB MXHigh
GOSUB MXLow
RETURN
MXHigh:
HIGH 1
FOR counter = 1 TO cycle
PULSOUT 2,1
NEXT
RETURN
MXLow:
LOW 1
FOR counter = 1 TO cycle
PULSOUT 2,1
NEXT
RETURN
MYLow:
HIGH 3
FOR counter = 1 TO cycle
PULSOUT 4,1
NEXT
RETURN
MYHigh:
LOW 3
FOR counter = 1 TO cycle
PULSOUT 4,1
NEXT
RETURN
·
·· It is possible that with a unique hardware setup like this it would be difficult to know exactly what effect code changes will have.· On the other hand I noticed the author of the code included his e-mail address in the comments…Have you tried e-mailing the author to see if he might have some advice?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
First, you should try to learn why the code you posted does what it does by going through the free "What's a Microcontroller?" text. If you achieve understanding from this, then you have solved your problem. If not, then someone might be more inclined to respond to a question directed from a lack of understanding about a specific something that you are trying to learn.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...
tom - i may have come across wrong im not after someone to do it for me. I wana learn but i dont know how, what is the best document to read???
In that case, I apologize if I mis-interpreted your "tone". It was done without the calming effects of my morning caffeine :^) The educational materials on the Parallax site, all free, do a great job of presenting the basics of both using their products and general electronics theory and application. A good path, IMHO, is the "What's a Microcontroller?" text leading to the "Robotics! with the BOE-Bot".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...
·
·· What is, “Not much help”?· What advice were you given, if any?· Perhaps you got the information you needed but did not understand it?· Please elaborate.· Details make it easier to help you.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
i have read a little about coding but dont really get it if im honest.
i have the code from boomdogs web site which half works. it just needs a little tweaking. like ive got a liquid sky effect (a line) on the x mirror but how do i get the y mirror to move up and down very slowly so the lines move up and down on the y mirror.
i wana do real simple stuff, just not sure where to start????????
its not going well for me, if anyone has any spare time to give me a hand could they MSN me camfun100@hotmail.com
i only wana do a few simple things, nothing major, i just dont get this coding stuff