Koda: |
#include <SoftwareSerial.h> //Create software serial object to communicate with SIM900 SoftwareSerial mySerial(7, 8); //SIM900 Tx & Rx is connected to Arduino #7 & #8 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+CSQ"); //Signal quality test, value range is 0-31 , 31 is the best updateSerial(); mySerial.println("AT+CCID"); //Read SIM information to confirm whether the SIM is plugged updateSerial(); mySerial.println("AT+CREG?"); //Check whether it has registered in the network updateSerial(); } void loop() { updateSerial(); } void updateSerial() { delay(500); while (Serial.available()) { mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port } while(mySerial.available()) { Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port } } |
Koda: |
#include <SoftwareSerial.h> //Create software serial object to communicate with SIM900 SoftwareSerial mySerial(7, 8); //SIM900 Tx & Rx is connected to Arduino #7 & #8 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+CMGS=\"+ZZxxxxxxxxxx\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms updateSerial(); mySerial.print("Last Minute Engineers | lastminuteengineers.com"); //text content updateSerial(); mySerial.write(26); } void loop() { } void updateSerial() { delay(500); while (Serial.available()) { mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port } while(mySerial.available()) { Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port } } |
Koda: |
void setup() { pinMode(9, OUTPUT); } void loop() { digitalWrite(9,HIGH); } |
Koda: |
void SIM900power() { pinMode(9, OUTPUT); digitalWrite(9,LOW); delay(1000); digitalWrite(9,HIGH); delay(2000); digitalWrite(9,LOW); delay(3000); } |
damjango je napisal/a: |
Bil pa je verjeno problem z napajanjem modula. |
frenki je napisal/a: |
Je napajanje modula dovolj stabilno? |