-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
107 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#define SOFT_MODEM_DEBUG 1 | ||
#include <SoftModem.h> // include the library | ||
#include <ctype.h> | ||
|
||
SoftModem modem; // create an instance of Softmodem | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
modem.begin(); // Setup () call to begin at | ||
pinMode(4, OUTPUT); | ||
pinMode(5, OUTPUT); | ||
pinMode(1, OUTPUT); | ||
digitalWrite(1, HIGH); | ||
digitalWrite(5, HIGH); | ||
digitalWrite(4, LOW); | ||
} | ||
|
||
unsigned long time = 0; | ||
|
||
void loop() | ||
{ | ||
if (time < millis()) { | ||
Serial.print("ints: "); | ||
Serial.print(modem.ints); | ||
Serial.print(":"); | ||
Serial.println(modem._ints); | ||
Serial.print("errs: "); | ||
Serial.print(modem.errs, DEC); | ||
Serial.print(":"); | ||
Serial.println(modem._errs, DEC); | ||
time = millis() + 10000; | ||
} | ||
while (modem.available()) { // Make sure iPhone is receiving data from | ||
int c = modem.read(); // Read 1byte | ||
if (isprint(c)) { | ||
Serial.print("received: "); | ||
Serial.println((char) c); // send to PC | ||
} | ||
else { | ||
Serial.print("("); // Hex printable characters are displayed in | ||
Serial.print(c, HEX ); | ||
Serial.println(")"); | ||
} | ||
} | ||
while (Serial.available()) { // Make sure that the PC receives data from | ||
char c = Serial.read(); // Read 1byte | ||
Serial.print("r: "); | ||
Serial.println(c); | ||
if (c == 'c') { | ||
modem.begin(); | ||
delay(100); | ||
modem.write(c); | ||
} | ||
#ifdef SOFT_MODEM_DEBUG | ||
else if (c == 'a') { | ||
Serial.print("ints: "); | ||
Serial.print(modem.ints); | ||
Serial.print(":"); | ||
Serial.println(modem._ints); | ||
Serial.print("errs: "); | ||
Serial.print(modem.errs, DEC); | ||
Serial.print(":"); | ||
Serial.println(modem._errs, DEC); | ||
} | ||
else if (c == 'v') { | ||
modem.demodulateTest(); | ||
} | ||
#endif | ||
else | ||
modem.write(c); // send to iPhone | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
####################################### | ||
# Syntax Coloring Map For SoftModem | ||
####################################### | ||
|
||
####################################### | ||
# Datatypes (KEYWORD1) | ||
####################################### | ||
SoftModem KEYWORD1 | ||
|
||
####################################### | ||
# Methods and Functions (KEYWORD2) | ||
####################################### | ||
|
||
begin KEYWORD2 | ||
end KEYWORD2 | ||
available KEYWORD2 | ||
read KEYWORD2 | ||
write KEYWORD2 | ||
|
||
####################################### | ||
# Instances (KEYWORD2) | ||
####################################### | ||
|
||
####################################### | ||
# Constants (LITERAL1) | ||
####################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters