我无法弄清楚如何与mikro electronica的GSM Click表单Arduino进行交互。我正在试用Arduino Uno(Rev3)和Arduino Nano。你能帮帮我吗,请联系Arduino并与之交谈?最好是用GSM库?
首先我将跳线J1更改为5 V(跳线上有一些焊料就可以了)?
我的联系如下: - 从Arduino的5V到GSM CLick的5V - 从GSM CLick(低于5V)的Arduino到Gnd的接地 - 将D2从Arduino连接到RX - 将D3从Arduino连接到TX - 将Arduino上的D7连接到GSM上的RST点击
我读到我也需要3.3侧的电源 - 将Arduino的3.3V连接至3.3 V. - 在3.3 CL引脚旁边的GSM CLick上将Arduino的GND连接到GND
当我在Arduino上连接USB时,绿灯亮起,但没有别的。这是我正在使用的代码的摘录...
我检查了GSM的3.3侧的电源,它是3.3。
#include <SoftwareSerial.h>
const int RST= 7; // D7 Connected to RST on GSM Click
const int RX=2; // D2 to RX
const int TX=3; // D3 to TX
int STA_value;
SoftwareSerial mySerial(RX,TX); // RX, TX
void setup() {
// initialize the digital pin as an output.
pinMode(RST, OUTPUT); // questo pin serve per accendere il dispositivo GSM
Serial.begin(9600); //Initialize Serial connection
gsmOn(); // turn on GSM
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("Arduino serial initialized!");
delay(10);
mySerial.begin(9600);
Serial.println("Software serial initialized!");
delay(10);
}
// the loop routine runs over and over again forever:
void loop()
{
sendCommand("AT"); //Set LED ON
readSerial();
}
void sendCommand(char* msg)
{
mySerial.print(msg);
Serial.println(msg);
delay(1000);
}
void readSerial()
{
while(mySerial.available()>0)
{
Serial.print(mySerial.read());
delay(100);
}
}
void gsmOn()
{
digitalWrite(RST, HIGH); // turn the Phone on
delay(300); // needs at least 200 ms
digitalWrite(RST, LOW);
delay(300);
}