|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Vex Programming Question
Quote:
If this doesn't solve it, then stick a zillion print statements into the code to trace what is happening and figure out where the logic you have implemented is flawed. Hopefully your deadline is 9 AM Left Coast time ![]() Good luck, Blake |
|
#2
|
||||
|
||||
|
Re: Vex Programming Question
The radio is only needed when using a template for FVC.
Ports 1-4 are configured to analog inputs if your using them with the bump sensors. You need to hit F5 and change the ports to digital inputs or move t he bump switch to ports 5-10. Another feature in easyC that is not used as much as it should be is the online window. This will show you real time what the controller is seeing on its inputs. Last edited by Kingofl337 : 02-05-2007 at 09:10. |
|
#3
|
||||
|
||||
|
Re: Vex Programming Question
Quote:
My problem occured a year ago using EasyC 1.x to write/compile a program that replaced the default user code that came in the Microcontroller. The default Master code that came with my Starter Kit from Radio Shack was in the microcontroller at the time. I wanted to use a bumper switch to alter/control my robot's otherwise autonomous behavior. No templates were explicitly involved. In that configuration, using the motor/servo commands I chose to employ in my program, to get the motors/servos to turn I had to turn on the transmitter. Everything else in the program was working just fine, but the commands that were supposed to make the PWM output ports do their thing were not working until I turned on the transmitter. Blake PS: Even if the bumper switch is attached to a port configured for analog input, isn't there a very high probability that the values that get returned will be either the expected 0 or the expected 255. Or... will the GetDigitalInput function simply fail silently (what happens?) at runtime if the port it tries to read is configured for analog use? |
|
#4
|
||||
|
||||
|
Re: Vex Programming Question
easyC 1.x never had any code to monitor the transmitter. The problem you were having was probably using "PWM Control".
Found inside the "RC Control" pallet Instead of a motor block. PWM was in a loop with the controller functions so it may have acted oddly without the controller turned on. This was later eliminated in V2 and later versions of easyC. Also, V5 is the correct master code version to use with easyC 1.x Last edited by Kingofl337 : 02-05-2007 at 14:31. |
|
#5
|
||||
|
||||
|
Re: Vex Programming Question
Quote:
I said that the transmitter had to be turned on before some programs (at least one) written using 1.X could work. And I think you just agreed with me. Acting "oddly", in my case, meant sitting there like a lump, cycling through my infinite loop just fine; but not issuing any useful (useful to me) commands to the PWM outputs, until the transmitter was turned on. It was a very frustrating night (and morning). If I remember correctly the PWMControl documentation did not mention any situations in which one might expect odd behavior. Blake Last edited by gblake : 02-05-2007 at 19:02. |
|
#6
|
|||||
|
|||||
|
Re: Vex Programming Question
Quote:
|
|
#7
|
|||
|
|||
|
Re: Vex Programming Question
Quote:
|
|
#8
|
||||
|
||||
|
Re: Vex Programming Question
Quote:
When I was first learnign to us EasyC, and I scanned the list of commands available in the "palettes"; I saw several that send something out to a PWM port. Among these, two under the heading of Outputs were Motor Module and Servo Module. Why on Earth there were two for doing exactly the same thing confused me. Whether a motor or a servo is connected to the computer is completely hidden from the software. Then, under the heading of RC Control, I found Motor Module Rx and Servo Module Rx. Like the two mentioned above, why two existed to do the same thing confused me; and why on Earth they have Rx in their names when their job is to control output ports made them even more perplexing. Also these two had an annoying list of cryptic input parameters that (unlike named variables) would make no sense to me 5 minutes after I set them. Four others, also found in the RC Control palette, Arcade 2 motor, Tank - 2 motor, Arcade 4-motor, and Tank 4-motor had even longer lists of cryptic parameters waiting to entangle me... yuck. If only there was an elegant, pure, simple command to just tell a PWM port what to emit, one without any other baggage attached to it. Oh, wait! There it is, the PWM Control command. But maybe not.... Hmmm, why is PWM Control under the RC Control palette? Neither its description nor its parameters make any mention of the transmitter or receiver; but then again, why should they? This command just tells a PWM port what to emit. Oh well, trying to guess the ancient quirks of coding preferences that lead to all these confusing names and palette organizations is a fool's errand. I'll trust the documentation and use the PWM Control command. It is simple and based on what I can read about it, it carries no extra baggage. Well... thereby hangs a tale (more than one apparently). KingofI337 says below (thank you King) that older versions of EasyC had a hidden linkage between PWM Control and whether or not the microcontroller (plus the implied receiver...) detected a valid signal from a transmitter. He says this is gone from more recent Vex EasyC versions. When we use those older versions, if we want to control PWM ports regardless of what is coming into the microcontroller from the receiver, I think we are supposed to use the Motor Module or Servo Module command(s) instead of the PWM Control command. I assume that which one you choose (Motor Module or Servo Module) is irrelevant, but I already guessed incorrectly above, so maybe they do have hidden differences and you shouldn't use my guesses (yes - I know that when given the same PWM signal, motors and servos rotate in different directions, but do the software "guts" of these functions contain any non-trivial differences???). So, for purely autonomous operation (no Transmitter needed) I think you remove all PWM Control commands and replace them with Motor/Servo Module commands. For autonomous operation when a transmitter is on (perhaps followed by teleoperated operation) I think you can use all PWM Control commands or all Motor/Servo Module commands If you want to mix Motor/Servo Module Commands and PWM Control commands in the same program, I seem to remember two things.
Blake PS: If my recommendations are wrong, please enlighten me/us. I freely admit that I was never the world's expert on this, and that I have been away from this side of things for a while. |
|
#9
|
|||
|
|||
|
Re: Vex Programming Question
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programming Vex w/ MPLab | dababyjebus | FIRST Tech Challenge | 27 | 25-04-2008 09:11 |
| VEX programming | Gene F | Programming | 14 | 08-08-2006 22:21 |
| Programming VEX Controller | HRobotics | Programming | 4 | 21-03-2006 23:25 |
| Vex like programming? | Morenoh149 | Programming | 2 | 09-07-2005 22:32 |
| Vex Programming | foobert | FIRST Tech Challenge | 3 | 24-06-2005 01:09 |