Stingray programming troubles
2pietjuh2
Posts: 5
Hey everyone,
I'm quite new to programming, and this parallax unit. We are working with a lot of people from school on about 12 stingray robots.
We made a program to control te DC motors to drive the stingray, which works.
We can read our line sensors, they work fine too.
But, if we make a program reading our line sensors and controlling the DC motors with our own build program it is doing completely random things we dont want.
Does anyone know what we are doing wrong?
Thanks for the help!
2pietjuh2
UPDATE: removed code from this post, and added it in an archieve as desired
linefollower - Archive [Date 2011.05.11 Time 20.19].zip
I'm quite new to programming, and this parallax unit. We are working with a lot of people from school on about 12 stingray robots.
We made a program to control te DC motors to drive the stingray, which works.
We can read our line sensors, they work fine too.
But, if we make a program reading our line sensors and controlling the DC motors with our own build program it is doing completely random things we dont want.
Does anyone know what we are doing wrong?
Thanks for the help!
2pietjuh2
UPDATE: removed code from this post, and added it in an archieve as desired
linefollower - Archive [Date 2011.05.11 Time 20.19].zip
Comments
This code doesn't even look like it would compile correctly. You use PST but it's not in the OBJ section.
The reason it doesn't work is because you don't ever call the getval routine from the Start routine. The program stops instantly unless you type "getval" at the bottom of the start routine I don't exactly understand the repeat loop either.
and welcome to the propeller-forum
You should attach your complete code to a posting.
This is easy to do with the archive function of the propeller-tool
In the propeller-tool activate that tab that contains your main program
From the main-menu choose File - Archive - Project ...
This will create a ZIP-archiv that contains all files needed to compile your code.
Use the Go advanced button bottom right of the website to change to the advanced posting website.
Click on Manage Attachments and upload the ZIP-archiv.
Then we can analyse the whole thing.
best regards
Stefan
Thanks for your reactions!
I attatched an achive with the full code. Hope someone can help me
Thanks ,
2pietjuh2
I tok a quick look into the code.
I'm not familiar with the pwm_32-object.
So I can do only a guessing. maybe switching on/off the motors just with 50% is too raw and maybe the repeat-loop is running too fast.
But that's just a guessing.
So what changes if you insert a waitcnt-command of 1 second or 0,1seconds?
How is the line-follower-sensor connected to the propeller?
best regards
Stefan
I will try that waitcnt-command for 0.1 second, if i try more i think I'll lose my line...
The line-follower-sensor was originally not for the stingray. But we switched 2 cables on each sensor and connected it to pin 0,1,2,3. This was on advice of our teachers. When using the parallax serial communicator and right code it responded as expected. but when we change the code a little bit, (in this case to eg. PWM.motor(1,0,50)) it wont work anymore...
hope I made my problem clear.
Thanks for any help!
2pietjuh2
John Abshier
PS. If I understand the code correctly, the PWM frequency for the motors is 60 Hz. Where did that come from? It looks low.
I changed the pins, made a mistake in prev post.
About the write statement, we did that. And that works. But it stops working when we change the write statement into something else.
So we can log in the terminal the output of the sensors (eg 1111 or 1010). But to start with, we used only sensor 0 and 1.
thanks,
2pietjuh2