Guys i really need some help here. Im actually a newbie programming, and i've got stuck at this error. If someone could help would be great. (Sorry for bad english, not my native language)
//Error:C:\DOCUME~1\ALUNO2~1\CONFIG~1\Temp\build1e5bb35abec021de725b24d345a61130.tmp/core\core.a(main.cpp.o): In function `main':
C:\Arquivos de programas\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:47: undefined reference to `loop'//
Here is my code (It's in portuguese but hopefully you understand it):
//Carrega bibliotecas
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
#include "EmonLib.h"
#include <SPI.h>
// Referênia a biblioteca emonl
EnergyMonitor emon1;
// Pinagem e configuração do display
Adafruit_PCD8544 display = Adafruit_PCD8544(8, 9, 10, 11, 12);
//Tensao da rede eletrica
int rede = 110;
//Pino do sensor SCT
int pino_sct = A1;
//Calcula a corrente
double Irms = emon1.calcIrms(1480);
//Variáveis globais
double potencia = Irmsrede/10003600;
double valor = potencia*0.75;
double valotT = valor;
void setup()
{
Serial.begin(9600);
//Pino, calibracao - Cur Const= Ratio/BurdenR. 2000/33 = 60
emon1.current(pino_sct, 60);
//Ajuste iniciais display
display.begin();
//Ajusta o contraste do display
display.setContrast(40);
//Apaga o buffer e o display
display.clearDisplay();
//Define tamanho do texto e cor
display.setTextSize(1);
display.setTextColor(BLACK);
//Retangulo principal
display.drawRect(0, 0, 84, 48, 2);
//Retangulo menor
display.fillRect(0, 0, 84, 15, 2);
display.setTextColor(WHITE, BLACK);
display.setCursor(15, 4);
display.println("TCC SENAI");
display.setTextColor(BLACK, WHITE);
display.setTextSize(1);
}
void loop(double Irms, double valorT, double potencia, double valor)
{
//Mostra o valor da corrente no serial monitor e display
Serial.print("Corrente : ");
Serial.print(Irms); // Irms
display.setCursor(8, 18);
display.print("Corr:");
display.print(Irms, 2);
display.display();
display.setCursor(67, 18);
display.println("A");
//Calcula e mostra o valor da potencia
Serial.print("Potencia :");
Serial.print(Irmsrede/10003600);
display.setCursor(8, 28);
display.println("Pot:");
display.setCursor(30, 28);
display.print(Irmsrede/10003600);
display.setCursor(67, 28);
display.println("kW");
//Calcula o valor do preço
for (double x=0;x<10;x++){
valorT= valorT+valor;
display.setCursor(8, 40);
display.print(valorT);
delay(1000);
}
}