Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Good Beginner Websites (http://www.chiefdelphi.com/forums/showthread.php?t=16331)

mistresshawk 11-01-2003 19:02

Good Beginner Websites
 
I'm a rookie, with a team that's just starting up this year. I was wondering if anyone has any good websites with manuals/tutorials to learn PBASIC, geared towards someone whose experiance with programming is limited to programming her TI-83 Calculator.

Help?

Raven_Writer 11-01-2003 19:09

Re: Good Beginner Websites
 
Quote:

Originally posted by mistresshawk
I'm a rookie, with a team that's just starting up this year. I was wondering if anyone has any good websites with manuals/tutorials to learn PBASIC, geared towards someone whose experiance with programming is limited to programming her TI-83 Calculator.

Help?

Read the PBASIC manual, and visit http://www.innovationfirst.com/firstrobotics/ and http://www.parallax.com. InnovationFIRST has some info on the code, and Parallax has some documentation also.

Damian Manda 11-01-2003 19:39

Luckily the commands are very similar in PBASIC and TI-Basic.
I dont know any websites, but here are some commands:
(TI-Basic is first, followed by PBASIC)

For(x,1,10)...End
For x = 1 to 10...Next

If x=1..Then..Else..End
If x=1 then..else..endif (2.5 syntax)

1-->x
x = 1

While x=1 ... End
Do While x=1 .. Loop

If you want any specific commands, I might know them as well.

-Damian Manda

Geoffrey4283 11-01-2003 22:52

"Error: Expected a label"
 
Hi, i'm just trying to see if anyone can explain to me the reason for thparticular error, or jsut help me figure out why my line of code won't work. We're just playing around with the EDU-Robots and some optical sensors from last year. Explain why simply adding this line of code after the Relay Feedback LIghts portion of the default code, and before the Output data, isn't working:
if rc_sw1 = 1 then drive_L = 190
It gives the error displayed in the subject of this "Expected a Label." I really don't know what it's asking for. It highlights drive_L and says expected a label. Can anyone help on that one? I've compared all previous uses of the variable drive_L, and there doesn't seem to be any difference from the way they've used it, to the way that I've used it. Any help would be appreciated, so thanks.

Geoff

Geoff_494 11-01-2003 23:33

In the old PBASIC syntax, IF...THEN loops can only be directed to a label, you can't put a command after the THEN statement. Working could would be something along the lines of:

IF rc_sw1 = 1 THEN motor_fwd
*insert code here for the rc_sw1 <> 1 condition*
motor_fwd:
drive_L = 190

Also, what optical sensors are you using? If you're using the banner sensors from last year, the 7.2 volt battery pack that came with the EduBot won't be enough to power them. You'll have to use an external circuit that delivers 10-30 V (consider 2 9V batteries in series).

Mongoose 12-01-2003 00:18

I hope you searched, there are a couple of rookie threads out there. But there's a pretty nice web site out there at http://www.first-codex.net which has some nice articles about programming. The good part is you get to use gotos and labels in your code just like in TI-BASIC.

Labels are labels in the code which... uh, label a section. You can jump around parts of your program by using the goto command. If you tell the program to go to a section marked by a label that doesn't exist, the editor screams at you.

Gobiner 12-01-2003 05:35

You might try contacting people from these forums on ICQ or AIM to get your questions answered. Spend enough time here and you notice a few people know everything, so just go straight for the jugular.

Raven_Writer 12-01-2003 15:38

Quote:

Originally posted by Gobiner
You might try contacting people from these forums on ICQ or AIM to get your questions answered. Spend enough time here and you notice a few people know everything, so just go straight for the jugular.
rbayer is a pretty smart dude. Just make sure your questions and/or answers don't have any spelling mistakes like "r" instead of "are"

rbayer 12-01-2003 15:41

Quote:

Originally posted by Raven_Writer
rbayer is a pretty smart dude. Just make sure your questions and/or answers don't have any spelling mistakes like "r" instead of "are"
lol. That was the day I spent filling out college apps all day. Let's just say I wasn't in a very good mood. Anyway, the point still stands: email me with any questions you may have and I normally respond within an hour.

--Rob

AJ Quick 12-01-2003 15:56

Quote:

Originally posted by rbayer
I normally respond within an hour.
He's not kidding either.

Raven_Writer 12-01-2003 15:59

Usually, it's amazing if it takes him 30 mins (:D ;))

Geoffrey4283 13-01-2003 10:18

Still not working
 
We've changed the code from the previous bit to this:

IF rc_sw1 = 1 THEN motor_fwd

drive_L = drive_L
goto end_optics:

motor_fwd:
drive_L = 254

end_optics:

The point of all this is that when we have the optical sensor reflecting, indicated by the solid or rapidly blinking red LED on the top of the banner sensor, we want the robot to move forward. It isn't, to say the least. The problem either lies with our program, or our contact between the white sensor cable and SW1 on the EDU robot. Any suggestions?

rbayer 13-01-2003 10:26

Are you sure that rc_sw1 gets set to 1 when the sensor "sees" a target? There are two signal wires (one black, one white) coming from the optical sensor; one will be 1 when the sensors sees something, the other will be 1 when it doesn't. Try a "debug? rc_sw1" and see what happens as you move a target in and out of its field of view.

Geoffrey4283 13-01-2003 10:35

Sort of
 
We've tried both the black and the white wires as we've been troubleshooting, and getting nothing out of either of them. At least, no response. Where do I do the "debug? rc_sw1"? Soudns like a very good idea, I just don't know how.

rbayer 13-01-2003 10:38

Put it anywhere between the Serin and Serout. After you send the program to the RC, leave the cable connected. A little blue window should pop up on your computer screen that scrolls the values of rc_sw1 whenever the robot is running.

Debug?, along with the rest of the debug family, are the staples of bug finding. Alternatively, you can drop your code in RoboEmu and see what happens when you turn on sw1. If it works in RoboEmu, it's probably an electrical issue.

Geoffrey4283 13-01-2003 10:52

EDU
 
Since I'm using the EDU robot, I've only got one DB15 to plug into. It has a built in 900MHz radio, so I have my OI plugged into the radio, and then I have the tether/program port on the Isaac 16 plugged into the COM1 on my computer. Should I turn it to program or tether in order to get it to run? Because neither seems to work.

rbayer 13-01-2003 10:56

program. Does the little blue window even show up after you send the code? If not, you may need to select New Debug Window (or something similar) from one of the menus. Ctrl+D may do this, but I'm not sure.

Geoffrey4283 13-01-2003 11:06

Tried that
 
No blue window is popping up. We already set one though, and it seems to be blocking the COM1 port now, and it won't let me clear it out. Blue window popped up, but not getting any signal. SO if you dont' think there's anything wrong with that bit of programming, then it must be our connections, or our variables. Thank you very much for your assistance.

Geoffrey4283 13-01-2003 14:47

Success!! Sort of....
 
Got the COM port cleared and successfully debugged rc_sw1, only to find out that no, the sensor is not getting across. Still unaware of the origin of the problem, waited until I returned home and dropped the code into RoboEmu as you suggested. It worked beautifully! Exactly what we wanted it to do. So apparently our problem is electrical, and we're probably going to spend some time analyzing electrical layouts and try to figure out what the heck is going on. Thanks for all the help on the program, we're halfway there.

Greg Ross 13-01-2003 18:22

<disclaimer>I'm only the programmer</disclaimer>

How many wires are you attaching to the switch inputs on the edubot? It sounds like you are only connecting one. When we hooked up the banner sensors to our edubot, I think we connected the white and black wires to each of the two pins of a switch input.

Geoffrey4283 13-01-2003 23:36

Ummmmm...
 
As far as I know, that's naughty? From what I've been told, and seen posted on these sites, you're only supposed to be using one. If that's not the case, it still shouldn't be causing a problem, because only one is necessary. Each is only sending a 1 or a 0, combining them doesn't do much else? I coudl very well be wrong though. Love to know it if I am? It would solve a lot of our problems.

Noah 13-01-2003 23:43

You can attach both wires to sensor inputs, but be aware that they are mutually exclusive: When one is on the other is off, and vice-versa. If you know the state of one wire you know the state of the other. If you plug them both in then your just using an extra sensor input, and if you program to check both of them your just wasting processer time.

Greg Ross 14-01-2003 00:50

Re: Ummmmm...
 
Quote:

Originally posted by Geoffrey4283
As far as I know, that's naughty? From what I've been told, and seen posted on these sites, you're only supposed to be using one. If that's not the case, it still shouldn't be causing a problem, because only one is necessary. Each is only sending a 1 or a 0, combining them doesn't do much else? I coudl very well be wrong though. Love to know it if I am? It would solve a lot of our problems.
Quote:

Originally posted by Noah
You can attach both wires to sensor inputs, but be aware that they are mutually exclusive: When one is on the other is off, and vice-versa. If you know the state of one wire you know the state of the other. If you plug them both in then your just using an extra sensor input, and if you program to check both of them your just wasting processer time.
I could be mistaken. (See the disclaimer.) Each switch input (on the edubot) has two pins. If you only use one of the wires, what do you do with the other pin? All I REALLY know is that we got it to work. I won't get a chance to examine our eduBot until Thursday.

rbayer 14-01-2003 01:19

You've got to make the switch input a complete circuit. At least that's how it works on the full-size RC. My team never used the EduBot w/sensors, but here's how I'm guessing you would do it based on how I wired the full RC last season:

Brown -> Power source +
Blue (ground)-> one of the switch pins
White or Black -> the other switch pin

Any EE people want to confirm this?

Geoffrey4283 14-01-2003 18:18

I understand, but that won't work on the EDU, as far as I know
 
Witht he EDu robot, that hook-up has one problem. There is no power provided on the Isaac 16 for sensors. It's not designed for it. So we've got two 9 volt batteries providing power to the sensor. If we put the blue ground to the ground on the Isaac 16, then the circuit with the batteries wouldn't be complete. We coudl try it though, just plugging it into the back of the 7.2 volt power supply on the battery pack. Just didn't seem like it was strong enough when we tried it before. We'll see. Definately looking for some EE support on this, probably going to post in their forum.

Eric Reed 17-01-2003 19:38

any more info?
 
Has anyone found the answer to this? There are two things I know:

1) The banner sensor has to be connected to both power + and ground.

2) Something must be hooked up to both of the sensor input pins

Also, I am 99.9% certain that it's not the two remaining sensor wires that get hooked up to the sensor input, since they both seem to be +.

Anyone who has used banner sensors with the EduBot successfully, please look to see how you wired it.

Thanks,

Eric.

Eric Reed 17-01-2003 20:36

Answered my own question
 
Okay, we figured it out.

Brown goes to the negative side of two 9-volt batteries connected in series.
Blue goes to the positive side of the 9-volt batteries.
Blue also goes to one pole of the switch input on the edubot
Black or White goes to the other pole of the switch.

Yay...it works!

Eric

Hailfire 18-01-2003 10:45

Go ahead and try: DevX and Parallax Inc.. Hope this helped.


All times are GMT -5. The time now is 11:56.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi