Snapshot.
This commit is contained in:
parent
917dd85465
commit
e573c1ed1b
|
@ -66,7 +66,8 @@ const int output26 = 26;
|
|||
const int output27 = 27;
|
||||
|
||||
// Timers
|
||||
auto timer = timer_create_default();
|
||||
//auto timer = timer_create_default();
|
||||
Timer<1> timer;
|
||||
auto time_until_start = timer_create_default();
|
||||
|
||||
// Example from https://github.com/contrem/arduino-timer#examples
|
||||
|
@ -143,15 +144,74 @@ String processor(const String& var){
|
|||
return String();
|
||||
}
|
||||
|
||||
// vvvvv Modify some functions from KB1OIQ's controller.
|
||||
// This section hasn't been tested on the hardware.
|
||||
|
||||
//int dit_len = 60 ; //milliseconds; https://morsecode.world/international/timing.html
|
||||
|
||||
//================================================================================
|
||||
// stop_26(): set GPIO 26 to LOW. Used for dot(), dash().
|
||||
//================================================================================
|
||||
bool stop_26(void *){
|
||||
output26State = "off";
|
||||
digitalWrite(output26, LOW);
|
||||
return false; // keep timer active? true
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
// dit(): transmit a single dit
|
||||
//================================================================================
|
||||
void dit(int dit_len = 1000) {
|
||||
output26State = "on";
|
||||
digitalWrite(output26, HIGH);
|
||||
timer.in(dit_len, stop_26);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
// dah(): transmit a single dah
|
||||
//================================================================================
|
||||
void dah(int dit_len = 1000) {
|
||||
output26State = "on";
|
||||
digitalWrite(output26, HIGH);
|
||||
timer.in(dit_len * 3, stop_26);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
// char_space()): transmit a character space
|
||||
//================================================================================
|
||||
// A function that does nothing except (hopefully) block the timer.
|
||||
bool empty(void *) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void char_space(int dit_len = 1000) {
|
||||
|
||||
timer.in(dit_len, empty);
|
||||
}
|
||||
|
||||
void k(){
|
||||
Serial.println("K");
|
||||
dah();
|
||||
char_space();
|
||||
dit();
|
||||
char_space();
|
||||
dah();
|
||||
}
|
||||
|
||||
// ^^^^
|
||||
|
||||
//================================================================================
|
||||
// setup(): stuff that only gets done once, after power up (KB1OIQ's description)
|
||||
//================================================================================
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
// Timer example, blink main LED
|
||||
pinMode(LED_BUILTIN, OUTPUT); // set LED pin to OUTPUT
|
||||
// call the toggle_led function every 10000 millis (10 second)
|
||||
timer.every(10000, toggle_led);
|
||||
//timer.every(10000, toggle_led);
|
||||
// call the toggle_gpio_26 function
|
||||
timer.every(1000, toggle_gpio_26);
|
||||
//timer.every(1000, toggle_gpio_26);
|
||||
|
||||
// Initialize the output variables as outputs
|
||||
pinMode(output26, OUTPUT);
|
||||
|
@ -224,6 +284,11 @@ void setup() {
|
|||
});
|
||||
server.onNotFound(notFound);
|
||||
server.begin();
|
||||
|
||||
|
||||
// Try to send "K" on startup? What about spaces? Don't use delay();
|
||||
k();
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
@ -232,8 +297,8 @@ void loop() {
|
|||
timer.tick();
|
||||
|
||||
String yourInputString = readFile(SPIFFS, "/inputString.txt");
|
||||
int yourInputInt = readFile(SPIFFS, "/inputInt.txt").toInt();
|
||||
float yourInputFloat = readFile(SPIFFS, "/inputFloat.txt").toFloat();
|
||||
// int yourInputInt = readFile(SPIFFS, "/inputInt.txt").toInt();
|
||||
// float yourInputFloat = readFile(SPIFFS, "/inputFloat.txt").toFloat();
|
||||
|
||||
// Blink LED according to seconds entered
|
||||
// if (yourInputInt > 0) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user