First commit

This commit is contained in:
2023-02-14 21:16:47 +00:00
commit bdcfde4821
26 changed files with 1455 additions and 0 deletions

View File

@ -0,0 +1,20 @@
#include "Lewis.h"
Lewis Morse;
void setup() {
// single recieve (RX) and transmit (TX) pin (simplex)
// Lewis will switch the pin to OUTPUT as required to send
Morse.begin(9);
}
void loop() {
Morse.print("ok");
delay(1000);
Morse.write('s');
delay(1000);
Morse.print(1);
delay(1000);
Morse.print(1.10);
delay(1000);
}

View File

@ -0,0 +1,28 @@
#include "Lewis.h"
#include <TimerOne.h>
Lewis Morse;
void setup() {
// use the long form of Morse.begin to allow interrupts:
// Morse.begin(rx_pin, tx_pin, words_per_minute, use_interrupts)
Morse.begin(2, 9, 20, true);
Timer1.initialize(10000);
Timer1.attachInterrupt(myISR);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
Morse.print("ok");
for (int i=0; i<4; i++) {
digitalWrite(LED_BUILTIN, HIGH);
delay(250);
digitalWrite(LED_BUILTIN, LOW);
delay(250);
}
}
void myISR()
{
Morse.timerISR();
}

View File

@ -0,0 +1,22 @@
#include "Lewis.h"
Lewis Morse;
void setup() {
// single recieve (RX) and transmit (TX) pin (simplex)
// Lewis will switch the pin to OUTPUT as required to send
Morse.begin(9);
}
void loop() {
// call checkIncoming often enough to catch the incoming presses
Morse.checkIncoming();
if (Morse.available()) {
char c = Morse.read();
if (c == 'k') {
delay(100);
Morse.print("ok");
}
}
}

View File

@ -0,0 +1,38 @@
#include "Lewis.h"
#include <TimerOne.h>
Lewis Morse;
void setup() {
// open the serial port
Serial.begin(9600);
// wait for serial port to connect on 32u4 boards (eg. Leonardo)
while (!Serial){;}
// use the long form of Morse.begin to allow interrupts:
// Morse.begin(rx_pin, tx_pin, words_per_minute, use_interrupts)
Morse.begin(2, 9, 20, true);
// use the TimerOne library for a 100Hz timer interrupt
Timer1.initialize(10000);
Timer1.attachInterrupt(MorseISR);
}
void loop() {
// send each serial byte to Morse output
if (Serial.available()) {
int inByte = Serial.read();
Morse.write(inByte);
}
// send each Morse byte to serial port
if (Morse.available()) {
int inByte = Morse.read();
Serial.write(inByte);
}
delay(500);
}
// your own defined interrupt function that includes the Morse.timerISR call
void MorseISR()
{
Morse.timerISR();
}

View File

@ -0,0 +1,38 @@
#include "Lewis.h"
#include <TimerOne.h>
Lewis Morse;
void setup() {
// open the serial port
Serial.begin(9600);
// wait for serial port to connect on 32u4 boards (eg. Leonardo)
while (!Serial){;}
// use the long form of Morse.begin to allow interrupts:
// Morse.begin(rx_pin, tx_pin, words_per_minute, use_interrupts)
Morse.begin(9, 9, 20, true);
// use the TimerOne library for a 100Hz timer interrupt
Timer1.initialize(10000);
Timer1.attachInterrupt(MorseISR);
}
void loop() {
// send each serial byte to Morse output
if (Serial.available()) {
int inByte = Serial.read();
Morse.write(inByte);
}
// send each Morse byte to serial port
if (Morse.available()) {
int inByte = Morse.read();
Serial.write(inByte);
}
delay(500);
}
// your own defined interrupt function that includes the Morse.timerISR call
void MorseISR()
{
Morse.timerISR();
}