Use arduinomorse instead of Jled #38
|
@ -69,6 +69,10 @@ int yourInputNtransmitters;
|
|||
int step_length = 10000; // 10 secs
|
||||
int cycle_id = 1; // number of this transmitter in cycle
|
||||
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)
|
||||
const char index_html[] PROGMEM = R"rawliteral(
|
||||
|
@ -609,7 +613,6 @@ void setup() {
|
|||
void loop() {
|
||||
// Timers
|
||||
timer.tick();
|
||||
|
||||
//morses_sequence_blink_test->Forever().Update();
|
||||
|
||||
// See which message we are sending
|
||||
|
@ -677,6 +680,14 @@ void loop() {
|
|||
// auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
||||
//morses_sequence_blink.Forever().Update();
|
||||
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
|
||||
programRunning = true;
|
||||
startProgram = false;
|
||||
|
@ -709,25 +720,35 @@ void loop() {
|
|||
//morseToSend_blink.Reset().Update();
|
||||
//morses_sequence_blink.Reset();
|
||||
//Serial.println("Start up cycle");
|
||||
if (!sender.continueSending())
|
||||
{
|
||||
// if(currentMillis - previousMillis > step_length) {
|
||||
if((millis() > start_millis) & (millis() < stop_millis)){
|
||||
// save the last time you started sending
|
||||
// previousMillis = currentMillis;
|
||||
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
|
||||
} else if((yourInputSend == 2) & (programRunning == false)){
|
||||
//Serial.println("Program is over, stop sending")
|
||||
//morses_sequence_blink.Stop();
|
||||
//sender.setMessage(String(""));
|
||||
// if you don't want to send code
|
||||
} else {
|
||||
} else if(yourInputSend == 0){
|
||||
//Serial.println("Stop sending");
|
||||
// stop sending and make sure the pin is off
|
||||
// morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update();
|
||||
// morseToSend_blink.Stop(JLed::eStopMode::FULL_OFF).Update();
|
||||
//morses_sequence_blink.Stop();
|
||||
//sender.setMessage(String(""));
|
||||
sender.setMessage(String(""));
|
||||
}
|
||||
//morseToSend.Update();
|
||||
//sender.continueSending();
|
||||
|
|
Loading…
Reference in New Issue
Block a user