Hi all..
i want ask why this code can't work with nodemcu, but work with arduino
#include<SoftwareSerial.h>
SoftwareSerial mySerial(4, 5); //D2, D1
void setup()
{
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
//Begin serial communication with Arduino and SIM900
mySerial.begin(9600);
Serial.println("Initializing...");
delay(1000);
mySerial.println("AT"); //Handshaking with SIM900
updateSerial();
mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
updateSerial();
mySerial.println("AT+CNMI=1,2,0,0,0"); // Decides how newly arrived SMS messages should be handled
updateSerial();
}
void loop()
{
sms();
}
void updateSerial(){
delay(500);
String buffer = "";
while(mySerial.available())
{
char c = mySerial.read();
Serial.print(c);
}
}
void sms(){
delay(500);
String buffer = "";
char c;
char d;
c = mySerial.read();
if(c == 'H'){
buffer += c;
while(mySerial.available()){
d = mySerial.read();
buffer += d;
}
Serial.print(buffer);
}
}
this is message from serial monitor
c⸮⸮axh⸮R⸮⸮Initializing...
⸮⸮
i connect pin
NODEMCU SIM900A
Vin -> VCC5
GND -> GND
D1 -> 5VR
D2 -> 5VT