Go Down

Topic: Arduino bee hive veighing scale  (Read 516 times) previous topic - next topic

trbancg

Hello.


I make making bee hive scale vich will once a day send measurment over gsm network (SMS) to my phone.
 But I have a problem.
I write the code chek it with program and everithing seems fine. But when I apload it to arduino and when the code starts the gsm module start blinking an error and I dont get data to my phone. Could somebody help. Pls

#include <TimeLib.h>
#include <TimeAlarms.h>
AlarmId id;
#include "HX711.h"

#define calibration_factor -7050.0 //This value is obtained using the SparkFun_HX711_Calibration sketch

#define DOUT  3
#define CLK  2

HX711 scale(DOUT, CLK);

#include <SoftwareSerial.h>   
#define rxPin 9 
#define txPin 8 
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin); 
float temp;
String MyString;
char currentLine[500] = "";
int currentLineIndex = 0;
void setup() {
  mySerial.begin(9600);
setTime(17,41,0,1,1,11);//nastavi cajt
Alarm.alarmRepeat(17,45,0,EveningAlarm);//nastavi casa odcitka
scale.set_scale(calibration_factor);
}

void loop() {

}
void EveningAlarm() {
  float t = (scale.get_units(), 1);
  temp=t;
  MyString = String(temp,0); //Convert float to String
MyString = (MyString + " Degrees C");
// convert string to char starts here
// Length (with one extra character for the null terminator)
int str_len = MyString.length() + 1;
// Prepare the character array (the buffer)
char char_array[str_len];
// Copy it over
MyString.toCharArray(char_array, str_len);

Serial.print("AT+CMGF=1\r");
delay(1000); 
Serial.print("AT+CMGS=\"+386xcdvcxscdsccds\"\r"); 
delay(1000); 
Serial.println(char_array); 
Serial.print("\r"); 
delay(1000); 
Serial.println((char)26); 
Serial.println();  }

Go Up