Set up scheduled program cycles #24
|
@ -69,6 +69,10 @@ int yourInputNtransmitters;
|
||||||
int step_length = 10000; // 10 secs
|
int step_length = 10000; // 10 secs
|
||||||
int cycle_id = 1; // number of this transmitter in cycle
|
int cycle_id = 1; // number of this transmitter in cycle
|
||||||
int n_transmitters = 2; //number of transmitters total
|
int n_transmitters = 2; //number of transmitters total
|
||||||
|
long previousMillis = 0;
|
||||||
|
long start_millis = 0;
|
||||||
|
long stop_millis = 0;
|
||||||
|
long pause_millis = 0;
|
||||||
|
|
||||||
// HTML web page to handle 3 input fields (inputString, inputSend, inputFloat)
|
// HTML web page to handle 3 input fields (inputString, inputSend, inputFloat)
|
||||||
const char index_html[] PROGMEM = R"rawliteral(
|
const char index_html[] PROGMEM = R"rawliteral(
|
||||||
|
@ -609,7 +613,6 @@ void setup() {
|
||||||
void loop() {
|
void loop() {
|
||||||
// Timers
|
// Timers
|
||||||
timer.tick();
|
timer.tick();
|
||||||
|
|
||||||
//morses_sequence_blink_test->Forever().Update();
|
//morses_sequence_blink_test->Forever().Update();
|
||||||
|
|
||||||
// See which message we are sending
|
// See which message we are sending
|
||||||
|
@ -677,6 +680,14 @@ void loop() {
|
||||||
// auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
// auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
||||||
//morses_sequence_blink.Forever().Update();
|
//morses_sequence_blink.Forever().Update();
|
||||||
Serial.println("Start sending");
|
Serial.println("Start sending");
|
||||||
|
|
||||||
|
//int period = morse_cycle.Period() + word_space_ms;
|
||||||
|
//int repeats = step_length / period;
|
||||||
|
//int remainder_wait = step_length - (period * repeats);
|
||||||
|
//int total_wait = ((step_length * (n_transmitters - 1)));
|
||||||
|
start_millis = millis();
|
||||||
|
stop_millis = start_millis + step_length;
|
||||||
|
pause_millis = stop_millis + step_length;
|
||||||
sender.startSending(); //arduinomorse
|
sender.startSending(); //arduinomorse
|
||||||
programRunning = true;
|
programRunning = true;
|
||||||
startProgram = false;
|
startProgram = false;
|
||||||
|
@ -709,11 +720,21 @@ void loop() {
|
||||||
//morseToSend_blink.Reset().Update();
|
//morseToSend_blink.Reset().Update();
|
||||||
//morses_sequence_blink.Reset();
|
//morses_sequence_blink.Reset();
|
||||||
//Serial.println("Start up cycle");
|
//Serial.println("Start up cycle");
|
||||||
if (!sender.continueSending())
|
// if(currentMillis - previousMillis > step_length) {
|
||||||
{
|
if((millis() > start_millis) & (millis() < stop_millis)){
|
||||||
// Set the internal counters to the message's beginning.
|
// save the last time you started sending
|
||||||
// Here, this results in repeating the message indefinitely.
|
// previousMillis = currentMillis;
|
||||||
sender.startSending();
|
if (!sender.continueSending()){
|
||||||
|
// Set the internal counters to the message's beginning.
|
||||||
|
// Here, this results in repeating the message indefinitely.
|
||||||
|
sender.startSending();
|
||||||
|
}
|
||||||
|
} else if((millis() > stop_millis) & (millis() < pause_millis)){
|
||||||
|
// do nothing
|
||||||
|
} else if((millis() > pause_millis)){
|
||||||
|
startProgram = true;
|
||||||
|
//start_millis = millis() + step_length;
|
||||||
|
//stop_millis = start_millis + step_length;
|
||||||
}
|
}
|
||||||
// if the cycle program is not running
|
// if the cycle program is not running
|
||||||
} else if((yourInputSend == 2) & (programRunning == false)){
|
} else if((yourInputSend == 2) & (programRunning == false)){
|
||||||
|
@ -721,13 +742,13 @@ void loop() {
|
||||||
//morses_sequence_blink.Stop();
|
//morses_sequence_blink.Stop();
|
||||||
//sender.setMessage(String(""));
|
//sender.setMessage(String(""));
|
||||||
// if you don't want to send code
|
// if you don't want to send code
|
||||||
} else {
|
} else if(yourInputSend == 0){
|
||||||
//Serial.println("Stop sending");
|
//Serial.println("Stop sending");
|
||||||
// stop sending and make sure the pin is off
|
// stop sending and make sure the pin is off
|
||||||
// morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update();
|
// morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update();
|
||||||
// morseToSend_blink.Stop(JLed::eStopMode::FULL_OFF).Update();
|
// morseToSend_blink.Stop(JLed::eStopMode::FULL_OFF).Update();
|
||||||
//morses_sequence_blink.Stop();
|
//morses_sequence_blink.Stop();
|
||||||
//sender.setMessage(String(""));
|
sender.setMessage(String(""));
|
||||||
}
|
}
|
||||||
//morseToSend.Update();
|
//morseToSend.Update();
|
||||||
//sender.continueSending();
|
//sender.continueSending();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user