2014-git-work/arduino/softmodemsample/softmodemsample.ino
2013-09-16 17:37:33 +09:00

49 lines
779 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
Arduinoとは次のように接続します右側がArduinoの端子
* FSKOUT→D3
* GND→GND
* VCC→VCC
* FSKIN→D6
* AIN1→D7
ボリューム調整
* 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);
}
}
}