Hey, I've designed a program to convert special format trames from an underwater acoustic positionning system to a AIS format trames which are readable on any Navigation system. I've got the soft part working fine, now I am beginning the hardware part which is composed by an 16*4 LCD screen and interrupts.
I would like to create an interface menu where I can choose the properties of my serial communication for the AIS trame. Is it possible to create two different program and linked them to assign some variable from my menu program to the main ?
Eg, my interface program which I've juste started :
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 4);
// Print a welcome message to the LCD.
lcd.print("Welcome on the USBL box from JIFMAR !");
delay(5000);
lcd.clear();
}
void loop() {
lcd.setCursor(8, 0);
lcd.print("MENU");
lcd.setCursor(0, 1);
lcd.print( "1: Target definition");
lcd.setCursor(0, 2);
lcd.print( "2: Serial ports ");
lcd.setCursor(0, 3);
lcd.print( "3: Start");
}
Once I am in the "Serial ports" menu I would like to set a variable Baudrate1 for exemple that I would use for the setup of my main pg:
void setup() {
Serial1.begin(Baudrate1); //on initialise les ports series
Serial2.begin(4800);
Serial3.begin(19200);
for (j=0;j<200;j++) { //RAZ du buffer de ligne
line[j] = ' ';
}
}
Thanks if you have any ideas, I would like to avoid to make longer my main which is already quite long
Vince