Arduino Rocket launcher code issues after updating the code with updated refs.

When I do this no errors in the format are detected. though now an error 2:29 occurs now when I try to verify the code.

Rocket_Launcher_updated_2 2:29 : error expected ';' before 'mySerialPort'
MySerialPort.write(0x10); // turn on the colon ":"

^

exit status1

Yes I fixed the missing brackets.

#define FuseTIME      1500  //Fuse current duration in milliseconds.
#include <SoftwareSerial.h>  //Call the SoftwareSerial library.

#define Fuse     7          //Pin connected to the Fuse (your LED or igniter)
#define GoButt   6          //Pin connected to the GO button
#define ArmButt  5          //Pin connected to the ARM button
#define BuzzPin  4          //Connected to the buzzer
#define TXdata   3          //Conneted to Rx of the Display
#define RXdata   2          //not used 
#define SetPot   0          //Analog Pin connected to the Potentiometer

SoftwareSerial mySerialPort(RXdata, TXdata);

void setup() {
  pinMode(TXdata, OUTPUT);
  pinMode(RXdata, INPUT);
  pinMode(Fuse, OUTPUT);
  pinMode(ArmButt, INPUT);        // set "ARM" button pin to input
  pinMode(GoButt, INPUT);         // set "GO" button pin to input
  digitalWrite(Fuse, LOW);        // OPEN the fuse circuit.
  digitalWrite(ArmButt, HIGH);    // turn on pull up resistor
  digitalWrite(GoButt, HIGH);     // turn on pull up resistor
  mySerialPort.begin(9600);
  delay(10);                      // Wait for Serial Display start up
  mySerialPort.print("v")      // Reset the display
  mySerialPort.print("z")      // Brightness
  mySerialPort.write(0x40);       // 3/4 Intensity
  mySerialPort.print("w")      // Decimal Point Control
  mySerialPort.write(0x10);       // turn on the colon ":"
}
int  DownCntr;                    // down counter (1/10 Secs)
int  Go = 0;                      // Stopped
void loop() {
  if (!digitalRead(GoButt) || !digitalRead(ArmButt)) {
    Go = 0;                       // Stops the countdown
    tone(BuzzPin, 440, 1500);
    delay(1500);
  }
  if (Go == 0) {
    WaitARM();
    WaitGO();
  }
  ShowTimer();
  if (DownCntr > 50) {
    if (DownCntr % 10 == 0)tone(BuzzPin, 1000, 50); // Beeps every second
  }
  else if (DownCntr % 2 == 0)tone(BuzzPin, 1000, 50); // Beep goes faster

  if (DownCntr == 0) {
    tone(BuzzPin, 440, FuseTIME);  // Launch tone
    digitalWrite(Fuse, HIGH);      // CLOSE the fuse circuit
    delay(FuseTIME);
    digitalWrite(Fuse, LOW);       // OPEN the fuse circuit
    Go = 0;
  }
  while (millis() % 100);         // wait for a moment
  delay(50);
  DownCntr--;
}

void WaitGO() {
  ShowTimer();
  while (digitalRead(GoButt));
  Go = 1;

  delay(20);
  while (!digitalRead(GoButt));   //  Debounce the GO button
}
void ReadTimer() {
  DownCntr = map(analogRead(SetPot), 0, 1023, 5, 60);
  DownCntr *= 10;
}
void ShowTimer() {
  String seconds = String (DownCntr, DEC);
  while (seconds.length() < 3)seconds = "0" + seconds; // format to 3 numbers
  mySerialPort.print(seconds);                         // Write to Display
  mySerialPort.print(" ");                             // Last digit switched off
}
void WaitARM() {
  while (digitalRead(ArmButt) == 1) {
    ReadTimer();
    delay(50);
    ReadTimer();
    ShowTimer();
    delay(150);
  }
  Go = 0;
  ShowTimer();
  tone(BuzzPin, 2000, 150);
  delay(200);
  tone(BuzzPin, 2000, 150);
  delay(200);
  tone(BuzzPin, 2000, 150);

  delay(20);
  while (!digitalRead(ArmButt));  // Debounce the ARM button

}
1 Like