How To Use Global & Local Variables In Easy C

Global & Local Variables to me separates a okay team from a great team because you can do operator control you can do autonomous that’s basically minimum requirements of a match in competition but if you use variables you are going above and beyond to try to defeat the opponent in every way possible you can and that’s how important variables are to me that being said here’s the video:

While Global/Local Variables may seem important. They in no way separate a good robot from a great robot. In my eyes, having PID Loops, Method-Based Blocks for Easily Writing Autonomii, and lastly, having Presets for Lifts are helpful, and in some cases may make a difference in between having a Good or Great Robot. But in the end, Having an amazingly well-constructed robot Intricate yet useless code. For example, lets say you have some crazy code that self-tunes your PID loop for you, yet your drivetrain is very unstable. Will that code really help correct mechanical flaws/Carelessness?

Again, how does localizing/globalizing variables make your robot THAT much better than everyone else’s robot?

Another Point to Reiterate: Stuff like PID loops, or a script that generates autonomous routines for you is helpful, but ONLY when your robot is well-constructed

Also an apology if I came off a bit too condescending. These are just my personal views, and I think everyone is entitled to their own.


have you seen the “jpearman programming challenge”? You should enter something and give it a shot.

Great video for teaching teams about the concept of variables in EasyC, but as others have stated, variables are not the only thing that determines how good a team is. It’s what one does with them, like creating advanced control loops or getting a robot to drive straight (which I’ve heard on the forums is almost impossible without some calculus. :D)

Also consider that even in the basic functions that “okay teams” would use, like “Joystick Digital to Motor” or “Joystick-Arcade/Tank” I’d assume there are plenty of variables used inside EasyC’s source code, (like for example, if the cortex is plugged into field control, in autonomous/teleop mode, etc) they’re all just presented in a user friendly interface for teams to get accustomed to programming.

The topic of global v/s local variables isn’t THAT big of a deal. I mean obviously it’s important to understand, but it’s not like you’re going to understand complex navigation and control with them alone.

Anyway I made a pretty good video tutorial on variables in PROS. I didn’t bother covering the exact difference between local and global variables, IE scope but I did cover the basics.

I’m sorry if I sounded like variables set a huge difference/ only deference between people who do use them and people that don’t. What I’m trying to say is that variables nice little things that can help your robot out and make it a better one like if you have a stable robot design and your code is lacking you could use them to boost your robots potential but if its flipped where the design is not on par and your programming is awesome you got different problems my amigos. Make sure your design is as good as your programming or vice versa. variables are good if you use them in the right place and right scenarios.

This makes a bit more sense. Perhaps you were overselling the use of private/global variables. Object oriented languages can “separate a good team from a bad team,” but only if the team knows how to use them properly. Regardless, using variable types or classes doesn’t make a robot good, it gives them a greater potential to be better by opening the programmer to new techniques.