I am trying to program my multi program for my robot, i it is basically a loop that reads that switch and if you press the switch it adds 1 to a variable that will determine what program it will run.
I made a simple program here
I don’t think i am adding variables correctly, how do i add 1 to count?
The variable count is an integer and the program is suppose to add 1 to it.
This is how i have it (Count + 1); It does not work this way.
It is suppose to print count if the switch is turned on.
Here is a code that will execute only when the bumper is pushed. After 3 pushes, the code will end.
#include<stdio.h>
main()
{
int x;
while(1)
{
If (x <= 3) //code will execute until the bumper
{ //has been hit 3 times
Get bumper input.....
Wait 100; //get bumper input more often
If ( bumper = 1); //pressed switch
{
tell motors what to do...
x++;
}
}
}
}
With determination and vigilience you will be comftarable programming in a couple of weeks, maybe days. The Easy C instruction manual helped a lot and so did this great website http://gd.tuwien.ac.at/languages/c/programming-bbrown/
Lets see… I started in JAN-1982, so I guess that makes it 26 years, 1 month now… I did not learn ‘C’ until 1988, so that is only 20 years… And I am still learning…
There is an old Programmers Adage, “The Best Code I wrote 10 Minutes ago, the Worst Code I wrote 6 Months ago”. And the same thing is true everyday…