Set up scheduled program cycles #24
|
@ -333,6 +333,27 @@ JLed morses_blink[] = {
|
|||
};
|
||||
auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
||||
|
||||
JLedSequence make_sequence(MorseEffect morse_effect, int gpio, int wpm, int step_length, int n_transmitters){
|
||||
int ms_per_dit = 1000 * (60 / (50 * wpm));
|
||||
int word_space_ms = ms_per_dit * 7;
|
||||
int period = morse_effect.Period();
|
||||
int repeats = step_length / period;
|
||||
int remainder_wait = step_length - (period * repeats);
|
||||
int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait));
|
||||
//auto blinker_continuous = JLed(gpio).UserFunc(&morse_effect).Repeat(repeats).DelayAfter(word_space_ms);
|
||||
//auto blinker_continuous_wait = JLed(gpio).Off(total_wait);
|
||||
JLed morses_blink[] = {
|
||||
JLed(gpio).UserFunc(&morse_effect).Repeat(repeats).DelayAfter(word_space_ms),
|
||||
JLed(gpio).Off(total_wait)
|
||||
};
|
||||
|
||||
auto sequence = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
||||
return sequence;
|
||||
}
|
||||
|
||||
auto morses_sequence_blink_test = make_sequence(morseEffectMOE, blinker, 10, 10000, 2);
|
||||
|
||||
|
||||
//================================================================================
|
||||
// start_program(): a function to start the planned program at the planned time
|
||||
//================================================================================
|
||||
|
@ -628,13 +649,13 @@ void loop() {
|
|||
//int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait));
|
||||
|
||||
// Nothing makes it out of this scope...
|
||||
blinker_continuous = JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats).DelayAfter(word_space_ms);
|
||||
blinker_continuous_wait = JLed(blinker).Off(total_wait);
|
||||
JLed morses_blink[] = {
|
||||
blinker_continuous,
|
||||
blinker_continuous_wait
|
||||
};
|
||||
auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
||||
// blinker_continuous = JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats).DelayAfter(word_space_ms);
|
||||
// blinker_continuous_wait = JLed(blinker).Off(total_wait);
|
||||
// JLed morses_blink[] = {
|
||||
// blinker_continuous,
|
||||
// blinker_continuous_wait
|
||||
// };
|
||||
// auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
||||
|
||||
morses_sequence_blink.Forever().Update();
|
||||
programRunning = true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user