2014-git-work/arduino/softmodemsample/softmodemsample.ino

50 lines
779 B
Arduino
Raw Normal View History

2013-02-26 00:38:35 +09:00
/*
Arduinoとは次のように接続しますArduinoの端子
* FSKOUTD3
* GNDGND
* VCCVCC
* FSKIND6
* AIN1D7
調
* 5V電源の場合2.7V
* 3.3V電源の場合1.95V
- http://code.google.com/p/arms22/wiki/SoftModemBreakoutBoard
*/
#include <SoftModem.h>
#include <ctype.h>
SoftModem modem;
void setup()
{
Serial.begin(57600);
delay(1000);
modem.begin();
}
void loop()
{
while(modem.available()){
char c = modem.read();
if(isprint(c)){
Serial.print(c);
}
else{
Serial.print("\\x");
Serial.print((uint8_t)c,HEX);
}
}
if(Serial.available()){
modem.write(0xff);
while(Serial.available()){
char c = Serial.read();
modem.write(c);
}
}
}