not able to grasp
mythix
Posts: 6
hi I am mythix I got my activity bot in December did all the quick projects but I am having problems with how to use the simple IDE I have no clue how to program or use other ports (1-15) and the others my, plan is I want to build it into a track based system with a camera, airsoft turret, and use buttons on a remote to turn lights camera on and off the last thing is I want to connect this all up and run it using and Xbox one controller. Is there any willing to help/teach me.
Comments
Welcome to the forums!
Are you programming in C or Spin?
Have you gone though all the Learn Examples?
http://learn.parallax.com/activitybot
If the controller uses an USB connection it probably needs to interface with a PC and then the PC would send commands to the robot.
There are lots of other game controllers which can be used directly with the Propeller. PlayStation 2 controllers are a good option. One of my favorite controllers to use with the Propeller is a wireless Wii Nunchuck. I used a wireless Nunchuck with my Halloween Hex robot.
A wireless PlayStation 2 shouldn't be too hard to add to the Propeller. There was a recent thread on this topic; I'll try to find it and add a link here.
I used a wired PlayStation 2 to control a Roomba. In order to make the connection wireless, I added a pair of Nordic nRF24L01+ transceivers. This required my use of a second Propeller to read the controller and send appropriate messages over a wireless link. It's a lot easier to start out with a wireless controller so a second microcontroller isn't needed.
One advantage of using a second controller with a transceiver such as the Nordic modules I used or a pair of XBees is then you can get telemetry back from the robot. With telemetry it would be possible to monitor the batteries voltage, the robot's speed and other parameters from your control unit. Here's a link to my (possibly overly) ambitious robot rebot. My robot remote has the potential of being really cool but it's just so darn complicated. When I temporarily (or so I thought) switched to using a wireless Nunchuck I was thrilled with how simple it was to use.
I think you'd be wise to start out with a wireless controller of some sort. The Wii Nunchuck and the PlayStation 2 are my top two recommendations for wireless controllers but they're mainly on my top two since I've used them (though my PS2 wasn't wireless). There may be other wireless controllers which would work well. I'd avoid a controller which uses an USB connection.
Another option is to use a transmitter and receiver from normal RC gear. These are pretty easy to use with the Propeller but they generally require an I/O pin for each control channel used.
Edit: Here's a link to Hal's wireless PlayStation 2 hack. Hal has just about convinced me I need one of these myself.
http://forums.parallax.com/showthread.php/161173-PS2-Wireless-Controller-Receiver-hack
Here's a link to the C software for the PS2 controller.
http://forums.parallax.com/showthread.php/160712-Propeller-C-for-PS2-Game-Controller
Post #4 of the thread has a link to a Spin version of the software. The Spin version will read from the PS2's analog buttons.
http://forums.parallax.com/showthread.php/158011-How-To-Use-XBee-to-communicate-between-ActivityBoard-and-ActivityBot
I don't use C much with the Propeller myself so I haven't used his method. It looks like he did a good job documenting his work.
int main()
{
while(1)
{
high(12);
pause(1000);
int t = rc_time(12, 1);
print("t = %d\n", t);
pause(100);
if t = 130 high(7) else t = 0 low(7);
}
} if this is not even close I would like to know... I am trying to learn tis with no prior education of all computer sci out side of typing class I truly need one on one with some one to vocally help me out other wise I might just have to sell the activitybot kit
Since you want to use Simple IDE, I assume you want to use C. Right? Edit: I hadn't seen post #10 when I wrote this post. Yes obviously you want to use C.
I think there are examples in the Learn site to control servos and examples on how to use a Ping sensor. I'm not sure what you mean by "ir drive".
While you'll likely be able to find example code to use various parts of the robot you want to make, it's very unlikely you'll find code to use all the things you want to include in a robot in the way you want to use them.
Chris the Carpenter used to run a small robot making business. He made a couple of videos where he asks some questions about a person's goal when they start building a robot.
https://sites.google.com/a/rocketbrandstudios.com/rocket-brand-studios/want-to-build-robot
I think Chris did a good job in pointing out why one will need to learn to to write code if one wants to build robots.
I think writing software for a robot is the most challenging parts of making a robot but I also think it's one of my favorite parts of making a robot.
I don't know C very well, but looking at the the code, you are reading p12 when you say the sensor is on p14.
It's unlikely the t will equal exactly 130. Usually you'd want to compare it some range of use "if t > 130" so it sets pin 7 high for any value above 130.
It's a lot easier to read code in the forum if you use code tags. Use "Reply With Quote" to see how I added the tags here.
Does the above code compile? The syntax doesn't look correct to me but I don't use C much.
The if statement syntax is not correct. Try:
if you are not going to need the low value of t don't bother to set t = 0. If you want to save 0 in t
then you will have to use { after else, put a semi colon after 0 and (7) and put a } after (7);
It would read:
Also be sure to check that the pin number for the sensor is the same as the one in the program, as mentioned above.
Tom
Hi Mythix,
If you are still using 0-9-64, you might want to upgrade to the latest version (1.0, RC2). It may include improvements to the C libraries your code is relying on.
http://learn.parallax.com/propeller-c-set-simpleide/windows
You might also take a look at some of the ActivityBot projects posted on the Learn site, as examples of using multiple sensors together. Vale's Joystick-controlled robot project is posted here, for example.
http://learn.parallax.com/projects/propeller-C-language
The "Remote Control Rock, Talk and Roll ActivityBot" uses a TV remote, instead of a flashlight, to activate the robot and drive it around. It uses the touch-whiskers to react if it hits objects, but the last page of the project shows how to modify one line of code to use the Ping))) sensor instead.
http://learn.parallax.com/project/remote-control-rock-talk-and-roll-activitybot