Arduino에서 AT 명령의 출력을 어떻게 캡처합니까?Arduino에서 AT 명령의 출력을 읽으려면 어떻게해야합니까?
저는 GSM 방패가 달린 Arduino Uno R3을 사용하고 있습니다. 나는 모든 AT 명령어 (they can be seen here)를 가지고 있으며, 터미널을 사용하고 출력을 얻으면 그것들을 입력 할 수있다. 그러나 결과 출력을 코드를 통해 어떻게 포착 할 수 있습니까? 아래 코드는 내가 시도한 것을 보여 주지만 작동하지 않습니다. 특히 내가 아날로그 입력을 얻고 그 결과를 프린트하려고 시도하는 곳. CADC AT + + 1 = CMGF
AT
:
난 출력을 얻을? 21 13#include <SoftwareSerial.h> SoftwareSerial mySerial(7, 8); void setup() { char sensorValue[32] =""; Serial.begin(9600); mySerial.begin(9600); Serial.println("\r"); //Wait for a second while the modem sends an "OK" delay(1000); //Because we want to send the SMS in text mode Serial.println("AT+CMGF=1\r"); delay(1000); mySerial.println("AT+CADC?"); //Query the analog input for data Serial.println(Serial.available()); Serial.println(Serial.read()); //Print out result??? //Start accepting the text for the message //to be sent to the number specified. //Replace this number with the target mobile number. Serial.println("AT+CMGS=\"+MSISDN\"\r"); delay(1000); Serial.println("!"); //The text for the message delay(1000); Serial.write(26); //Equivalent to sending Ctrl+Z } void loop() { /* if (mySerial.available()) Serial.write(mySerial.read()); if (Serial.available()) mySerial.write(Serial.read()); */ }
또는 CADC AT + + 1 = CMGF
AT
? 18 65
에 관계없이 내 아날로그 소스의 변화
그래, 사용 가능한()을 확인하기 위해 코드를 다르게 작성했지만, 방금 입력 한 명령을 다시 얻었습니다. 명령을 다시 보내는 결과는 어떻게 얻을 수 있습니까? – BOMEz
당신은 가용성에 대한 테스트를하고 myserial에서 읽어보십시오. –