SX/B robotics?
I have just learned how to use the SX/B compiler in the first experiments of the book, but
Is SX/B useful in robotics?
can an SX chip using an SX/B program
run servos?
use ultrasound sensors?
use IR sensors?
and do other things?
I can't find any program examples, and I can't find out how to run servos in the the book
help!
-Henry
![yeah.gif](http://forums.parallax.com/images/smilies/yeah.gif)
signature move
Is SX/B useful in robotics?
can an SX chip using an SX/B program
run servos?
use ultrasound sensors?
use IR sensors?
and do other things?
I can't find any program examples, and I can't find out how to run servos in the the book
help!
-Henry
![yeah.gif](http://forums.parallax.com/images/smilies/yeah.gif)
signature move
Comments
You can use PULSOUT to run servos (just like in PBASIC), use an ISR to manage them in the background (I've shown how in another thread), or with the SX48 you can use the Timers to generate servo command signals (see the SX/B help file).
from the bottom up:
how do I control standard servos?
ok, I downloaded the book, I still don't understand how to drive servos
I am trying to put together a course for the SX chip using SX/B. What I use as my guide is the "What's a microcontroller" book by Andy Lindsey. He does a great job of describing the concepts and then putting them into code. (grin) None of this stuff can be learned in a single day. It takes time. I always recommend to my friends that they buy the Parallax $80 kit (sold by Radio Shack) and when they are done going through that book's activities (about 40 hours), then come ask me questions.
The thing odd about the question (and Jon's rolling eyes, I'm sure) is that ANY microcontroller can control a servo with enough patience. The microcontroller needs to output a precisely controlled pulse and there are thousands of chips that can do that.
I choose the SX processor for my course precisely because the Basic Stamp book (i.e. What's a Microcontroller) is used in GRADE SCHOOLS (grin) and I teach at the college level. Thus, I am going to expect a little more dedication from my students and a lot less of "I'm bored, can we blow something up with this chip!" type of attitude (again tongue in cheek).
As for your initial question, may I draw your attention to several examples of how to do it using the Basic Stamp:
Servos - What's a Microcontroller, pg 148
Ultrasonic Sensors - the data sheet for the sensor has a sample program
IR Sensors - Parallax has a whole book called "IR Remote for the Boe-Bot"
Again, all of these are in Basic Stamp PBasic which is very similar. You will find that both Jon and Bean have very clever adaptations of PBASIC code into SX/B. In return, they expect that you research how to declare variables, be able to light LEDs, read push button switches, master loops and other fundamental programming techniques. If SX/B is your FIRST programming language, then it is going to be much more difficult than learning PBASIC as a first language. This is because PBASIC is a more mature language, has much more reference material, has been adapted to classroom settings and has many independent authors that have adopted PBASIC as their language of choice. SX/B is still in its adolescent days and as such it is like a wild west outpost. (If you want to feel you are further out than that, try tackling the Propeller chip, that one is still in the pre-school stages
Bottom Line: If you master the What's a Microcontroller book, I guarantee that you will be able to master SX/B in due time. The ones that have the most difficulty are the ones that want to skip all of the "baby steps".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
so my question is about how easy it would be to transfer the BS2 code to the SX code (assembly right?), like what would be some of the things I would have to do BS2 to transfer
Good luck,
Robert