Use arduinomorse instead of Jled #38
|
@ -304,60 +304,60 @@ auto morseMO5 =
|
||||||
auto morseToSend = morseTEST; // set this up to overwrite later
|
auto morseToSend = morseTEST; // set this up to overwrite later
|
||||||
|
|
||||||
// CW for blinker
|
// CW for blinker
|
||||||
auto morseTEST_blink =
|
// auto morseTEST_blink =
|
||||||
JLed(blinker).UserFunc(&morseEffectTEST).DelayAfter(word_space_ms).Forever();
|
// JLed(blinker).UserFunc(&morseEffectTEST).DelayAfter(word_space_ms).Forever();
|
||||||
auto morseMOE_blink =
|
// auto morseMOE_blink =
|
||||||
JLed(blinker).UserFunc(&morseEffectMOE).DelayAfter(word_space_ms).Forever();
|
// JLed(blinker).UserFunc(&morseEffectMOE).DelayAfter(word_space_ms).Forever();
|
||||||
auto morseMOI_blink =
|
// auto morseMOI_blink =
|
||||||
JLed(blinker).UserFunc(&morseEffectMOI).DelayAfter(word_space_ms).Forever();
|
// JLed(blinker).UserFunc(&morseEffectMOI).DelayAfter(word_space_ms).Forever();
|
||||||
auto morseMOS_blink =
|
// auto morseMOS_blink =
|
||||||
JLed(blinker).UserFunc(&morseEffectMOS).DelayAfter(word_space_ms).Forever();
|
// JLed(blinker).UserFunc(&morseEffectMOS).DelayAfter(word_space_ms).Forever();
|
||||||
auto morseMOH_blink =
|
// auto morseMOH_blink =
|
||||||
JLed(blinker).UserFunc(&morseEffectMOH).DelayAfter(word_space_ms).Forever();
|
// JLed(blinker).UserFunc(&morseEffectMOH).DelayAfter(word_space_ms).Forever();
|
||||||
auto morseMO5_blink =
|
// auto morseMO5_blink =
|
||||||
JLed(blinker).UserFunc(&morseEffectMO5).DelayAfter(word_space_ms).Forever();
|
// JLed(blinker).UserFunc(&morseEffectMO5).DelayAfter(word_space_ms).Forever();
|
||||||
auto morseToSend_blink = morseTEST_blink; // set this up to overwrite later
|
// auto morseToSend_blink = morseTEST_blink; // set this up to overwrite later
|
||||||
|
|
||||||
// Cycle stuff
|
// Cycle stuff
|
||||||
auto morse_cycle = morseEffectMOS;
|
// auto morse_cycle = morseEffectMOS;
|
||||||
int period = morse_cycle.Period() + word_space_ms;
|
// int period = morse_cycle.Period() + word_space_ms;
|
||||||
int repeats = step_length / period;
|
// int repeats = step_length / period;
|
||||||
int remainder_wait = step_length - (period * repeats);
|
// int remainder_wait = step_length - (period * repeats);
|
||||||
int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait));
|
// int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait));
|
||||||
auto blinker_continuous = JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats).DelayAfter(word_space_ms);
|
// auto blinker_continuous = JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats).DelayAfter(word_space_ms);
|
||||||
auto blinker_continuous_wait = JLed(blinker).Off(total_wait);
|
// auto blinker_continuous_wait = JLed(blinker).Off(total_wait);
|
||||||
JLed morses_blink[] = {
|
// JLed morses_blink[] = {
|
||||||
blinker_continuous,
|
// blinker_continuous,
|
||||||
blinker_continuous_wait
|
// blinker_continuous_wait
|
||||||
};
|
// };
|
||||||
auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
// auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JLedSequence* sequence = NULL;
|
// JLedSequence* sequence = NULL;
|
||||||
JLedSequence* make_sequence(JLedSequence* seq, const char* message, int wpm, int step_length, int n_transmitters){
|
// JLedSequence* make_sequence(JLedSequence* seq, const char* message, int wpm, int step_length, int n_transmitters){
|
||||||
int ms_per_dit = 60;//1000 * (60 / (50 * wpm));
|
// int ms_per_dit = 60;//1000 * (60 / (50 * wpm));
|
||||||
int word_space_ms = ms_per_dit * 7;
|
// int word_space_ms = ms_per_dit * 7;
|
||||||
MorseEffect morse_effect(message, ms_per_dit);
|
// MorseEffect morse_effect(message, ms_per_dit);
|
||||||
int period = morse_effect.Period();
|
// int period = morse_effect.Period();
|
||||||
int repeats = 2;//step_length / period;
|
// int repeats = 2;//step_length / period;
|
||||||
int remainder_wait = step_length - (period * repeats);
|
// int remainder_wait = step_length - (period * repeats);
|
||||||
int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait));
|
// int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait));
|
||||||
Serial.print("total_wait: "); Serial.println(total_wait);
|
// Serial.print("total_wait: "); Serial.println(total_wait);
|
||||||
JLed morses_blink[] = {
|
// JLed morses_blink[] = {
|
||||||
JLed(blinker).UserFunc(&morse_effect).Repeat(repeats).DelayAfter(word_space_ms),
|
// JLed(blinker).UserFunc(&morse_effect).Repeat(repeats).DelayAfter(word_space_ms),
|
||||||
JLed(blinker).Off(total_wait)
|
// JLed(blinker).Off(total_wait)
|
||||||
};
|
// };
|
||||||
if (seq){
|
// if (seq){
|
||||||
delete seq;
|
// delete seq;
|
||||||
//seq = new JLedSequence(JLedSequence::eMode::SEQUENCE, leds);
|
// //seq = new JLedSequence(JLedSequence::eMode::SEQUENCE, leds);
|
||||||
seq = new JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
// seq = new JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
||||||
}
|
// }
|
||||||
return seq;
|
// return seq;
|
||||||
}
|
// }
|
||||||
// Initial definition of the sequence
|
// // Initial definition of the sequence
|
||||||
JLedSequence* morses_sequence_blink_test = make_sequence(sequence, "MOE", 10, 10000, 2);
|
// JLedSequence* morses_sequence_blink_test = make_sequence(sequence, "MOE", 10, 10000, 2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -411,10 +411,10 @@ void setup() {
|
||||||
|
|
||||||
// Initialize the output variables as outputs
|
// Initialize the output variables as outputs
|
||||||
pinMode(keyer, OUTPUT);
|
pinMode(keyer, OUTPUT);
|
||||||
pinMode(blinker, OUTPUT);
|
//pinMode(blinker, OUTPUT);
|
||||||
// Set outputs to LOW
|
// Set outputs to LOW
|
||||||
digitalWrite(keyer, LOW);
|
digitalWrite(keyer, LOW);
|
||||||
digitalWrite(blinker, LOW);
|
//digitalWrite(blinker, LOW);
|
||||||
|
|
||||||
// Initialize SPIFFS
|
// Initialize SPIFFS
|
||||||
SPIFFS.begin(true);
|
SPIFFS.begin(true);
|
||||||
|
@ -441,30 +441,31 @@ void setup() {
|
||||||
// On restart, keep doing what you were doing before
|
// On restart, keep doing what you were doing before
|
||||||
yourInputMsg_old = yourInputMsg;
|
yourInputMsg_old = yourInputMsg;
|
||||||
if(yourInputMsg == 0){
|
if(yourInputMsg == 0){
|
||||||
morseToSend = morseTEST;
|
// morseToSend = morseTEST;
|
||||||
morseToSend_blink = morseTEST_blink;
|
// morseToSend_blink = morseTEST_blink;
|
||||||
sender.setMessage(String("test test test de w1cdn "));
|
sender.setMessage(String("test test test de w1cdn "));
|
||||||
} else if(yourInputMsg == 1){
|
} else if(yourInputMsg == 1){
|
||||||
morseToSend = morseMOE;
|
// morseToSend = morseMOE;
|
||||||
morseToSend_blink = morseMOE_blink;
|
// morseToSend_blink = morseMOE_blink;
|
||||||
sender.setMessage(String("moe "));
|
sender.setMessage(String("moe "));
|
||||||
} else if(yourInputMsg == 2){
|
} else if(yourInputMsg == 2){
|
||||||
morseToSend = morseMOI;
|
// morseToSend = morseMOI;
|
||||||
morseToSend_blink = morseMOI_blink;
|
// morseToSend_blink = morseMOI_blink;
|
||||||
sender.setMessage(String("moi "));
|
sender.setMessage(String("moi "));
|
||||||
} else if(yourInputMsg == 3){
|
} else if(yourInputMsg == 3){
|
||||||
morseToSend = morseMOS;
|
// morseToSend = morseMOS;
|
||||||
morseToSend_blink = morseMOS_blink;
|
// morseToSend_blink = morseMOS_blink;
|
||||||
sender.setMessage(String("mos "));
|
sender.setMessage(String("mos "));
|
||||||
} else if(yourInputMsg == 4){
|
} else if(yourInputMsg == 4){
|
||||||
morseToSend = morseMOH;
|
// morseToSend = morseMOH;
|
||||||
morseToSend_blink = morseMOH_blink;
|
// morseToSend_blink = morseMOH_blink;
|
||||||
sender.setMessage(String("moh "));
|
sender.setMessage(String("moh "));
|
||||||
} else if(yourInputMsg == 5){
|
} else if(yourInputMsg == 5){
|
||||||
morseToSend = morseMO5;
|
// morseToSend = morseMO5;
|
||||||
morseToSend_blink = morseMO5_blink;
|
// morseToSend_blink = morseMO5_blink;
|
||||||
sender.setMessage(String("mo5 "));
|
sender.setMessage(String("mo5 "));
|
||||||
}
|
}
|
||||||
|
//sender.startSending();
|
||||||
|
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
WiFi.begin(ssid, password);
|
WiFi.begin(ssid, password);
|
||||||
|
@ -616,29 +617,29 @@ void loop() {
|
||||||
if(yourInputMsg != yourInputMsg_old){
|
if(yourInputMsg != yourInputMsg_old){
|
||||||
//morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update();
|
//morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update();
|
||||||
if(yourInputMsg == 0){
|
if(yourInputMsg == 0){
|
||||||
morseToSend = morseTEST;
|
// morseToSend = morseTEST;
|
||||||
morseToSend_blink = morseTEST_blink;
|
//morseToSend_blink = morseTEST_blink;
|
||||||
sender.setMessage(String("test test test de w1cdn "));
|
sender.setMessage(String("test test test de w1cdn "));
|
||||||
} else if(yourInputMsg == 1){
|
} else if(yourInputMsg == 1){
|
||||||
morseToSend = morseMOE;
|
// morseToSend = morseMOE;
|
||||||
sender.setMessage(String("moe "));
|
sender.setMessage(String("moe "));
|
||||||
morseToSend_blink = morseMOE_blink;
|
// morseToSend_blink = morseMOE_blink;
|
||||||
} else if(yourInputMsg == 2){
|
} else if(yourInputMsg == 2){
|
||||||
morseToSend = morseMOI;
|
// morseToSend = morseMOI;
|
||||||
sender.setMessage(String("moi "));
|
sender.setMessage(String("moi "));
|
||||||
morseToSend_blink = morseMOI_blink;
|
// morseToSend_blink = morseMOI_blink;
|
||||||
} else if(yourInputMsg == 3){
|
} else if(yourInputMsg == 3){
|
||||||
morseToSend = morseMOS;
|
// morseToSend = morseMOS;
|
||||||
sender.setMessage(String("mos "));
|
sender.setMessage(String("mos "));
|
||||||
morseToSend_blink = morseMOS_blink;
|
// morseToSend_blink = morseMOS_blink;
|
||||||
} else if(yourInputMsg == 4){
|
} else if(yourInputMsg == 4){
|
||||||
morseToSend = morseMOH;
|
// morseToSend = morseMOH;
|
||||||
sender.setMessage(String("moh "));
|
sender.setMessage(String("moh "));
|
||||||
morseToSend_blink = morseMOH_blink;
|
// morseToSend_blink = morseMOH_blink;
|
||||||
} else if(yourInputMsg == 5){
|
} else if(yourInputMsg == 5){
|
||||||
morseToSend = morseMO5;
|
// morseToSend = morseMO5;
|
||||||
sender.setMessage(String("mo5 "));
|
sender.setMessage(String("mo5 "));
|
||||||
morseToSend_blink = morseMO5_blink;
|
// morseToSend_blink = morseMO5_blink;
|
||||||
}
|
}
|
||||||
// Keeps the key/led from locking up
|
// Keeps the key/led from locking up
|
||||||
yourInputMsg_old = yourInputMsg;
|
yourInputMsg_old = yourInputMsg;
|
||||||
|
@ -687,27 +688,33 @@ void loop() {
|
||||||
// if you want to send continuous code, and it's not sending, then start it up
|
// if you want to send continuous code, and it's not sending, then start it up
|
||||||
if((yourInputSend == 1) & (morseToSend.IsRunning() == false)){
|
if((yourInputSend == 1) & (morseToSend.IsRunning() == false)){
|
||||||
//jled
|
//jled
|
||||||
morseToSend.Reset().Update();
|
// morseToSend.Reset().Update();
|
||||||
morseToSend_blink.Reset().Update();
|
// morseToSend_blink.Reset().Update();
|
||||||
|
|
||||||
// if you want to send continuous code, and it is sending, keep sending
|
// if you want to send continuous code, and it is sending, keep sending
|
||||||
} else if((yourInputSend == 1) & (morseToSend.IsRunning() == true)){
|
} else if((yourInputSend == 1) & (morseToSend.IsRunning() == true)){
|
||||||
morseToSend.Update();
|
|
||||||
morseToSend_blink.Update();
|
|
||||||
|
|
||||||
// if you want to send cycle code and it is sending, keep sending
|
|
||||||
} else if((yourInputSend == 2) & (programRunning == true)){//&(morses_sequence_blink.Update() == true)
|
|
||||||
//morseToSend.Update();
|
//morseToSend.Update();
|
||||||
//morseToSend_blink.Update();
|
//morseToSend_blink.Update();
|
||||||
//morses_sequence_blink.Update();
|
|
||||||
sender.continueSending();
|
// if you want to send cycle code and it is sending, keep sending
|
||||||
|
// } else if((yourInputSend == 2) & (programRunning == true)){//&(morses_sequence_blink.Update() == true)
|
||||||
|
// //morseToSend.Update();
|
||||||
|
// //morseToSend_blink.Update();
|
||||||
|
// //morses_sequence_blink.Update();
|
||||||
|
// //Serial.println("Continue cycle");
|
||||||
|
// sender.continueSending();
|
||||||
// if you want to send cycle code and it's not sending, then start it up
|
// if you want to send cycle code and it's not sending, then start it up
|
||||||
// } else if((yourInputSend == 2) & (programRunning == true) & !sender.continueSending()){//& (morses_sequence_blink.Update() == false)
|
} else if((yourInputSend == 2) & (programRunning == true)){//& (morses_sequence_blink.Update() == false)
|
||||||
// //morseToSend.Reset().Update();
|
//morseToSend.Reset().Update();
|
||||||
// //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");
|
||||||
// sender.startSending();
|
if (!sender.continueSending())
|
||||||
|
{
|
||||||
|
// Set the internal counters to the message's beginning.
|
||||||
|
// Here, this results in repeating the message indefinitely.
|
||||||
|
sender.startSending();
|
||||||
|
}
|
||||||
// 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)){
|
||||||
//Serial.println("Program is over, stop sending")
|
//Serial.println("Program is over, stop sending")
|
||||||
|
@ -715,12 +722,12 @@ void loop() {
|
||||||
//sender.setMessage(String(""));
|
//sender.setMessage(String(""));
|
||||||
// if you don't want to send code
|
// if you don't want to send code
|
||||||
} else {
|
} else {
|
||||||
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