Just wondering if Parallax carries something like the Sharp GP2D120 infrared sensor kit. And would something like that be compatible wth BasicStamp or SX.
This device shows promise. For my robot application I am pursuing using an SXxx, and SX/B as my prefered hobby/prototyper tool. In order to use this device, somewhere in the code you have to use "word", which SX/B does not support. Has anybody been able to overcome that, and possibly share a snippet of code. Basically I will be using at least three of these devices to check for objects, and when necesary make decissions on what do next in terms of how close the object(s) are. Once I can overcome the "word" aspect in SX/B, I can start thinking about using other devices that Parallax sells.
The output of the Sharp sensor we carry is less than 5 volts so you could connect it directly to the SX using the comparator ADC project shown in the SX/B help file. Since the range is 80 cm, you could construct a simple look-up table to to handle the conversion from reading to distance -- no Word variables required.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Jon Williams Applications Engineer, Parallax
Thanks Jon,
I will have to re-read your Nuts&Volts article on that and see if I can come up with some code. I would have never thought of that, the table approach. Since the values are a given, less than 255, byte size, then that approach should work, I hope. Back to the drawing board. Life would be so much easier if SX/B had word variables.·
I'm in the middle of my January column at the moment, otherwise I'd try it myself. Since I'm on vacation this week I'll get out the sensor and give it a try (it'll be good for the SX/B help file) when the article is off my desk.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Jon Williams Applications Engineer, Parallax
Rsadeika, believe it or not working with word variables is not nessesary to get the demo program to work correctly.
Only two variables are word length: Volts and slope.
The reason Volts is word form is because an average of 3 measurements is taken, there are two methods of averaging (V1+V2+V3)/3 and V1/3+V2/3+V3/3, if you replace the former with the latter you will circumvent the need for a word sized variable, better yet would be to take four measurements then do a right shift two places on each result.
Slope measures the delta between points. It is the subtraction of two bytes multiplied·by 2, which may overrun·a byte but I suspect that if you unroll the code you can find a similar workaround as with the Volts variable.
PS word values can be accommodated in SX/B, it just requires an array of 2 bytes with simple subroutines to replace normal operations (such as an addW2W (add word to word) would be: add two low bytes, store in target low byte, increment target high byte if carry set, add two higher bytes, store in target high byte)
The way I learn is by working with examples, I can take examples, read the code , see what is being done, play around with the code to see what else happens, so on and so forth. The reason I migrated to BasicStamp is because of the existing code, I can take existing code, I know it works, manipulate it to fit my needs, and that minimizes the amount of questions I have to ask on the forum. I would rather be working with code as opposed to trying to formulate the texture of a question so it fits everybodies paramaters.
As to the PS Paul, I tried doing something like that,·it never worked for me, I got frustrated and almost gave up on this particular hobby.
I just glanced at the code, another tool I can add to my tool box. I am thinking maybe something like a lib file that could be included within an SX/B program whenever you want access to special functions, now how would that work. I am sure that the 'bit bangers' already have something like that already. The only problem is how to extract just the routine that you need, so you do not have excess code.
Hmmm,
You would almost have to put each routine into a different file and LOAD or INCLUDE that file if you needed that routine.
Check out the "LOAD" and "INCLUDE" commands in SX/B.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
Comments
·and it is compatable with the basic stamp II. If you look at the bottom of the page, under "downloads", there is even Pbasic example code.
Hope that helps.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
·
For some reason when I was looking I did not stumble across this.
Thanks in advance.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I will have to re-read your Nuts&Volts article on that and see if I can come up with some code. I would have never thought of that, the table approach. Since the values are a given, less than 255, byte size, then that approach should work, I hope. Back to the drawing board. Life would be so much easier if SX/B had word variables.·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Only two variables are word length: Volts and slope.
The reason Volts is word form is because an average of 3 measurements is taken, there are two methods of averaging (V1+V2+V3)/3 and V1/3+V2/3+V3/3, if you replace the former with the latter you will circumvent the need for a word sized variable, better yet would be to take four measurements then do a right shift two places on each result.
Slope measures the delta between points. It is the subtraction of two bytes multiplied·by 2, which may overrun·a byte but I suspect that if you unroll the code you can find a similar workaround as with the Volts variable.
PS word values can be accommodated in SX/B, it just requires an array of 2 bytes with simple subroutines to replace normal operations (such as an addW2W (add word to word) would be: add two low bytes, store in target low byte, increment target high byte if carry set, add two higher bytes, store in target high byte)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
As to the PS Paul, I tried doing something like that,·it never worked for me, I got frustrated and almost gave up on this particular hobby.
So I'll post them here again.
Bean.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module" Now available from Parallax for only·$49.95
http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
"Ability may get you to the top, but it takes character to keep you there."
Post Edited (Bean (Hitt Consulting)) : 2/9/2006 1:32:17 AM GMT
I just glanced at the code, another tool I can add to my tool box. I am thinking maybe something like a lib file that could be included within an SX/B program whenever you want access to special functions, now how would that work. I am sure that the 'bit bangers' already have something like that already. The only problem is how to extract just the routine that you need, so you do not have excess code.
You would almost have to put each routine into a different file and LOAD or INCLUDE that file if you needed that routine.
Check out the "LOAD" and "INCLUDE" commands in SX/B.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module" Now available from Parallax for only·$49.95
http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
Those that would give up freedom for security will have neither.
·