![]() |
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? |
Re: Good Beginner Websites
Quote:
|
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 |
"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 |
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). |
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. |
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.
|
Quote:
|
Quote:
--Rob |
Quote:
|
Usually, it's amazing if it takes him 30 mins (:D ;))
|
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? |
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.
|
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.
|
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. |
| All times are GMT -5. The time now is 13:11. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi