Серийный номер программы ничего не отображает (SIM 800L) - PullRequest
0 голосов
/ 18 января 2019

Я использую ЖК-дисплей с датчиком температуры и хочу отправить текст, когда температура достигнет определенного градуса Цельсия. Модуль GSM SIM 800L в настоящее время мигает каждые 3 секунды, поэтому он работает. Другие используемые скрипты, похоже, отправляют текст. С моим кодом ничего не отображается в программном последовательном мониторе и текст не отправляется. Пожалуйста помоги. Код ниже:

#include<LiquidCrystal.h>
#include <SoftwareSerial.h>
#include "Adafruit_FONA.h"

//This* part declares that the RX, TX and RST pins of the SIM800L must be connected
//to pin 2, 3 and 4 of the Arduino.
#define FONA_RX 3
#define FONA_TX 2
#define FONA_RST 4

SoftwareSerial fonaSS = SoftwareSerial(FONA_RX, FONA_TX);
Adafruit_FONA fona = Adafruit_FONA(FONA_RST);
LiquidCrystal lcd(12, 11, 5, 9, 7, 8);


const int sensor=A1; // Assigning Analog Pin A 1to variable 'sensor'
float tempc; //variable to store temperature in degree Celsius
float tempf; //variable to store temperature in Fahrenheit
float vout; //temporary variable to hold sensor reading

void setup()
{
    pinMode(sensor,INPUT); // Configuring pin A1 as INPUT Pin
    Serial.begin(9600);
    lcd.begin(16,2);
    delay(100);
}

void loop()
{
    vout=analogRead(sensor);
    vout=(vout*500)/1023;

    tempc=vout; // Storing value in degrees Celsius
    tempf=(vout*1.8)+32; // Converting Temperature value from degrees Celsius to Fahrenheit

    lcd.setCursor(0,0);
    lcd.print("DegreeC= ");
    lcd.print(tempc);
    lcd.setCursor(0,1);
    lcd.print("Fahrenheit=");
    lcd.print(tempf);

    delay(1000); //Delay of 1 second for ease of viewing in serial monitor
    if (tempc > 20.0) {
        SendSms();
    }
}

void SendSms() {  
        char sendto[] = "+447874072326"; //put the desired destination phone number for sms here
        char message[141];
        sprintf(message, "Alert TEMP is %.2f", tempc);// limit to 140
         //sends the message via SMS
        if (!fona.sendSMS(sendto, message)) {
      Serial.println(F("error"));
    } else {
      Serial.println(F("sent!"));
    }
}

Я бы хотел помочь решить проблему, которая не отображается на программном последовательном мониторе. Спасибо за любую помощь.

...