A Hovercraft

Help me with identifying what the problem(s) is in this code for a hovercraft.

int m2 = A2;
int p1 = 1;
int f1 = A1;
int f3 = A3;
int m1 = A5;
// There are two motors with transistors (tip120) on the + lead as a esc on pins A2 and A5.
// A Piezo on pin D1 for the warning.
//And the fans are two to a transistor on pins A1 and A3.
//Written by: Lukas Severinghaus on 4/18/12.
void setup(){}
void loop(){
goto "start";
goto "Forward";
goto "turn";
goto "forward";
goto "STOP";
}
void "start"(){
HIGH = p1;
delay(2500);
LOW = p1;
analogWrite(f1, 255);
analogWrite(f2, 255);
}
void "Forward"(){
analogWrite(m1, 255);
analogWrite(m2, 255);
delay(2000);
analogWrite(m1, 0);
analogWrite(m2, 0);
}
void "turn"(){
analogWrite(m2, 200);
delay(2500);
analogWrite(m2, 0);
}

void "STOP"(){
HIGH = p1;
delay(5000);
LOW = p1;
analogWrite(f1, 0);
analogWrite(f2, 0);
}

Perhaps you should tell us what exactly is not working with it, rather than leaving us to guess?

There is so much wrong there, I have to ask. Have you looked at any of the example sketches? Or any of the tutorial pages? Or any other C programs?

goto "start";
goto "Forward";
goto "turn";
goto "forward";
goto "STOP";

You can't goto a character literal. Even if you could, you wouldn't goto a function anyway, you would just call it.

void "start"(){

Function names are not character literals.

  HIGH = p1;

You can't assign a variable to a constant.

Look at the examples in the IDE. Google for C tutorial and learn some basics.

Help me with identifying what the problem(s) is in this code for a hovercraft.

The major problem is that the code is not written in C. I don't know what language it is written in but it is defiantly not C and as such will not run on the arduino.

You also have not defined any pins as outputs so you can never control anything.

my interpretation of your code to something that compiles, don't have a clue if it does what you want but it might help you

int m2 = A2;
int p1 = 1;
int f1 = A1;
int f2 = A3;
int m1 = A5;

void setup()
{
  start();
  forward();
  turn();
  forward();
  stop();
}

void loop()
{

}

void start()
{
  digitalWrite(p1, HIGH);
  delay(2500);
  digitalWrite(p1, LOW);
  analogWrite(f1, 255);
  analogWrite(f2, 255);
}

void forward()
{
  analogWrite(m1, 255);
  analogWrite(m2, 255);
  delay(2000);
  analogWrite(m1, 0);
  analogWrite(m2, 0);
}

void turn()
{
  analogWrite(m2, 200);
  delay(2500);
  analogWrite(m2, 0);
}


void stop()
{
  digitalWrite(p1, HIGH);
  delay(2500);
  digitalWrite(p1, LOW);
  analogWrite(f1, 0);
  analogWrite(f2, 0);
}

Looking at the quality of your code I advice you to spend a day or 5 on the tutorial section of Arduino to get familiar how to code it. It seems like a lot of time but it will be worth it as you will learn all the fundamentals how to program the A.

And if you serious want to control a hovercraft you should learn to code without delay() function as it blocks your system from new commands.

Succes.

int p1 = 1;

This implies you are trying to use pin 1 as an output. This is used by the serial communications along with pin 0. Pick another pin.

The analog pins A2,A1,A3, A5 are for analogRead() only. To use analogWrite(), use Digital pin 3,5,6,9,10,11. Look at your UNO closely, and see the ~ <-- the tiny wave character. That indicate the PWM pins for an analogWrite().

I look at the original program, it look like a BASIC program... Arduino use C++ variant. Don't think BASIC when coding the Arduino, Think C++.

What are you trying to do ? The motors are control by a relay ? A transistor using a PWM wave to control the motors ?

I agree with Grumpy_Mike here about pin 1. For me, I never use pin 0, 1 and 13. Specialy digital pin 0 and pin 1. To me, they call "Someone using the bathroom / toilet" pins :grin: So you don't use the bathroom / toilet when someone is inside.