Adrduino Uno R4 Wifi + GSM shield SIM900

Odpovědět
pindras
Příspěvky: 2
Registrován: 02 pro 2023, 09:53
Reputation: 0

Adrduino Uno R4 Wifi + GSM shield SIM900

Příspěvek od pindras » 02 pro 2023, 10:06

zdravim,
normalne mi funguje komunikace - posilani a prijem SMS pomoci shieldu SIM900 pripojeneho k Arduino UNO R3. Pokud pouziju stejny shield, stejny kod, stejne piny na Arduinu R4, tak mi shield sms neprijima ani neodesila. Nevite kde by mohl byt zakopany jednorozec? Diky

Priklad kodu:

Kód: Vybrat vše

//Program to send and receive SMS using SIM900A, Arduino and a terminal
//https://ee-diary.blogspot.com

#include <SoftwareSerial.h>

//configure software serial on Arduino pin 8 and 7 to communicate with SIM900
SoftwareSerial sim900(7,8); //Rx, Tx

void setup()
{
  //configure serial communication with terminal
  Serial.begin(9600);
  //configure serial communication with SIM900A GSM module
  sim900.begin(19200);
  Serial.println("Initializing...ok"); 
  delay(1000);
  Serial.println("Press 's' to send and 'r' to receive SMS"); 
}

void loop()
{
  if (Serial.available()>0)
         switch(Serial.read()){
          case 's':
            sendSMS();
            break;
          case 'r':
            recieveSMS();
            break;
         }
}

void serialPrint()
{
  delay(500);
  while (Serial.available()) 
  {
    sim900.write(Serial.read());//send typed text on terminal to SIM900A
  }
  while(sim900.available()) 
  {
    Serial.write(sim900.read());//send received text on SIM900A to terminal
  }
}

 void sendSMS(){
          sim900.println("AT+CMGF=1");    //Sets GSM Module in SMS Mode
          serialPrint();
          sim900.println("AT+CMGS=\"+XXXXXXXXXXXX\""); // set phone number to send SMS
          serialPrint();
          sim900.println("From Sim900A: ee-diary");// SMS content
          sim900.write(26);// CTRL+Z ascii code to exit SMS mode
          serialPrint();
      }

 void recieveSMS(){
          sim900.println("AT+CMGF=1");  //set GSM module in SMS mode
          serialPrint();
          sim900.println("AT+CNMI=1,2,0,0,0");  //select SMS read mode to show received SMS
          serialPrint();
      }

pindras
Příspěvky: 2
Registrován: 02 pro 2023, 09:53
Reputation: 0

Re: Adrduino Uno R4 Wifi + GSM shield SIM900

Příspěvek od pindras » 02 pro 2023, 19:15

vyřešeno - přepojeno na piny 0 a 1

Odpovědět

Kdo je online

Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 42 hostů