Skip to content

Instantly share code, notes, and snippets.

@burakaydn
Last active December 25, 2015 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burakaydn/6a6914698d41811186cd to your computer and use it in GitHub Desktop.
Save burakaydn/6a6914698d41811186cd to your computer and use it in GitHub Desktop.
Arduino softmodem sketch
#include <SoftModem.h>
#include <ctype.h>
SoftModem modem;
void setup()
{
Serial.begin(1225);
delay(1000);
modem.begin();
}
void loop() {
while(modem.available()){
int c = modem.read();
if (isprint(c)) {
Serial.print("Read CHR(");
Serial.print((char)c);
Serial.println(")");
} else {
Serial.print("Read HEX(");
Serial.print(c,HEX);
Serial.println(")");
}
}
if(Serial.available()){
modem.write(0xff);
while(Serial.available()) {
char c = Serial.read();
modem.write(c);
// Serial.print("Write CHR(");
// Serial.print(c);
// Serial.println(")");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment