#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
SMSGSM sms;
int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
#include "HX711.h"
int Weight = 0;
const int down = 7;
const int up = 6;
const int ok = 5;
const int cancel = 4;
const int numReadings = 20;
int p;
int denda;
//int ngirim;
int readings[numReadings];
int readIndex = 0;
int total = 0;
int weight = 0;
int berattot = 0;
void berat()
{
Weight = Get_Weight();
total = total - readings[readIndex];
readings[readIndex] = Weight;
total = total + readings[readIndex];
readIndex = readIndex + 1;
if (readIndex >= numReadings) {
readIndex = 0;
}
berattot = total / numReadings;
p = berattot / 10;
Serial.println(p);
delay(1);
lcd.setCursor(2,0);
lcd.print("BERAT: TON");
if (p < 0)
{//delay (100);
lcd.setCursor(9,0);
lcd.print("0"); }
if (p > 0)
{//delay (100);
lcd.setCursor(9,0);
lcd.print(p); }
delay(50);
//lcd.clear();
}
void setup()
{
Init_Hx711();
lcd.begin(20,4);
delay(3000);
Get_Maopi();
for (int thisReading = 0; thisReading < numReadings; thisReading++) {
readings[thisReading] = 0;
}
Serial.begin(9600);
Serial.println("GSM Shield testing.");
if (gsm.begin(2400)){
Serial.println("\nstatus=READY");
started=true;
}
else Serial.println("\nstatus=IDLE");
if(started){
// if (sms.SendSMS("+6285741119138", "Arduino SMS"))
// Serial.println("\nSMS sent OK");
}
}
void loop()
{
menu();
}
void menu()
{
MENU1:
lcd.setCursor(0,0);
lcd.print("PILIH JENIS TRUK");
lcd.setCursor(0,1);
lcd.print(">>Engkel");
lcd.setCursor(0,2);
lcd.print(" Tronton");
lcd.setCursor(0,3);
lcd.print(" Trailer");
if (digitalRead(up)==LOW)
{delay (500); lcd.clear();goto MENU3;}
if (digitalRead(down)==LOW)
{delay (500); lcd.clear();goto MENU2;}
if (digitalRead(ok)==LOW)
{delay (500); lcd.clear();goto KAT1;}
goto MENU1;
MENU2:
lcd.setCursor(0,0);
lcd.print("PILIH JENIS TRUK");
lcd.setCursor(0,1);
lcd.print(" Engkel");
lcd.setCursor(0,2);
lcd.print(">>Tronton");
lcd.setCursor(0,3);
lcd.print(" Trailer");
if (digitalRead(up)==LOW)
{delay (500); lcd.clear();goto MENU1;}
if (digitalRead(down)==LOW)
{delay (500); lcd.clear();goto MENU3;}
if (digitalRead(ok)==LOW)
{delay (500); lcd.clear();goto KAT2;}
goto MENU2;
MENU3:
lcd.setCursor(0,0);
lcd.print("PILIH JENIS TRUK");
lcd.setCursor(0,1);
lcd.print(" Engkel");
lcd.setCursor(0,2);
lcd.print(" Tronton");
lcd.setCursor(0,3);
lcd.print(">>Trailer");
if (digitalRead(up)==LOW)
{delay (500); lcd.clear();goto MENU2;}
if (digitalRead(down)==LOW)
{delay (500); lcd.clear();goto MENU1;}
if (digitalRead(ok)==LOW)
{delay (500); lcd.clear();goto KAT3;}
goto MENU3;
KAT1:
berat();
if (p > 20)
{lcd.clear(); delay (100);
lcd.setCursor(0,2);
lcd.print("OVERLOAD"); }
if (p > 5 && p < 20)
{lcd.clear(); delay (100);
lcd.setCursor(0,1);
lcd.print("OK Selamat Jalan >>>");}
denda = (p-20)*500;
Serial.println(denda);
lcd.setCursor(0,4);
lcd.print("DENDA: Rp ");
if (denda < 0) {delay (100);
lcd.setCursor(10,4);
lcd.print("0"); }
if (denda > 20) {delay (100);
lcd.setCursor(10,4);
lcd.print(denda); }
if (digitalRead(cancel)==LOW)
{delay (500); lcd.clear();goto MENU1;}
goto KAT1;
KAT2:
berat();
if (p > 27)
{lcd.clear(); delay (100);
lcd.setCursor(0,2);
lcd.print("OVERLOAD"); }
if (p > 5 && p < 27)
{lcd.clear(); delay (100);
lcd.setCursor(0,1);
lcd.print("OK Selamat Jalan >>>");}
denda = (p-27)*500;
Serial.println(denda);
lcd.setCursor(0,4);
lcd.print("DENDA: Rp ");
if (denda < 0) {delay (100);
lcd.setCursor(10,4);
lcd.print("0"); }
if (denda > 27) {delay (100);
lcd.setCursor(10,4);
lcd.print(denda); }
if (digitalRead(cancel)==LOW)
{delay (500); lcd.clear();goto MENU1;}
goto KAT2;
KAT3:
berat();
if (p > 30)
{lcd.clear(); delay (100);
lcd.setCursor(0,2);
lcd.print("OVERLOAD"); }
if (p > 5 && p < 30)
{lcd.clear(); delay (100);
lcd.setCursor(0,1);
lcd.print("OK Selamat Jalan >>>");}
denda = (p-30)*500;
Serial.println(denda);
lcd.setCursor(0,4);
lcd.print("DENDA: Rp ");
char ngirim = (char) denda;
String stringOne = String('ngirim');
if (denda < 0) {delay (100);
lcd.setCursor(10,4);
lcd.print("0"); }
if (denda > 30) {delay (100);
lcd.setCursor(10,4);
lcd.print(denda);
if(started){
sms.SendSMS("+6285741119138", (ngirim));}
if (digitalRead(cancel)==LOW)
{delay (500); lcd.clear();goto MENU1;}
goto KAT3;
}
void kirim()
{
if(started){
if(gsm.readSMS(smsbuffer, 160, n, 20))
{
Serial.println(n);
Serial.println(smsbuffer);
}
delay(1000);
}
}
invalid conversion from 'char*' to 'char' -fpermissive
I try to send data from load cell, but I get problem like this. how to resolve this problem ?