Skip to content

Instantly share code, notes, and snippets.

@DenverDias
DenverDias / dotPeriod
Created Aug 16, 2013
Defining dotPeriod
View dotPeriod
#define dotPeriod 100
@DenverDias
DenverDias / Floating dotPeriod
Last active Dec 21, 2015
Defining a floating dotPeriod
View Floating dotPeriod
#define dotPeriod (analogRead(2))
@DenverDias
DenverDias / Defining a dah
Created Aug 16, 2013
Setting the sequence for a dah
View Defining a dah
void dah()
{
tone(tonePin, buzz);
delay(dahPeriod);
noTone(tonePin);
delay(relaxtime);
}
@DenverDias
DenverDias / Defining a di
Created Aug 16, 2013
Making inner dits prettier
View Defining a di
void di()
{
dit();
}
View Global scope variables
int Index=0, endofstring, i;
//This creates dummy variables to index letters
char Input[255];
//This is required to store the input data temporarily
View Morse loop()
void loop()
{
while(!Serial.available());
//This command makes it wait until the Serial data is sent
while(Serial.available())
{
Input[Index]=Serial.read();
//Stores the byte of data from the serial buffer
Serial.print(Input[Index]);
//Prints out the same data
@DenverDias
DenverDias / otherPeriods
Created Aug 16, 2013
Other base Morse definitions
View otherPeriods
#define dashPeriod (dotPeriod*3)
#define relaxTime (dotPeriod)
#define letterSpace (dotPeriod*2)
#define wordSpace (dotPeriod*4)
@DenverDias
DenverDias / buzz frequency and output pin
Created Aug 16, 2013
Defining fixed frequency and output pin for Morse code
View buzz frequency and output pin
#define buzz 1000
#define tonePin 3
View Floating buzz output frequency
#define buzz (analogRead(1)+200)
@DenverDias
DenverDias / Defining a dit
Created Aug 16, 2013
Setting a sequence for a dit
View Defining a dit
void dit()
{
tone(tonePin, buzz);
delay(dotPeriod);
noTone(tonePin);
delay(relaxtime);
}