Nä, det ska du inte behöva ha.
När jag får felmeddelande som liknar ditt, så har jag oftast glömt ett ; på någon rad eller ibland någon måsvinge. Det är bara att dubbelkolla koden.
Nopp har kollat och dubbelkollat, allt som behövs finns med i forma av måsvingar, komman osv... Om jag uncomment anrops raden så fungerar det att kompilera den, men inte om den raden är aktiv i koden. Så det känns som om det är fel på själva anropet ändå, frågan är bara vad??
Jag länkar ut hela koden så får vi se vom ni kanske upptäcker något, men skäll inte för mycket på mig om koden, den ska städas
Kod: Markera allt
// =========================================================================================================
// Programmer: Johnny (JonLee) Lindberg. Date: 20140309
// This program vill controll and show the Watercooling system for my computer, fully built it vill
// have 8 fans, 2 waterpumps, 4 tempsensors, 2 waterflow sensors, 2 waterleakage sensors and computer
// controll on/off switching. It will show all data on a I2C LCD 4*20 display.
// It will take a start button event and checks if all waterpumps, fans start and flows/spins as
// expected if so it will trigger the computer to start and thereafter keep track of temp, waterflows
// and fan speed for the cooler. if any of these get out of range it will take a security shutdown and
// alarm with a buzzer and show what data that went out of range. It will also keep track of normal
// computer shutdown so when it shutsdown if temp is to high it will run cooling untill it is within
// given parameters.
// ========================================================================================================
// Including librarys
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>
// Data wire is plugged into port 3 on the Arduino
#define ONE_WIRE_BUS 3
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// Declare variables
float tempC;
float fanTempMax = 24.00;
int fanSpeedMin = 80;
int fanSpeedMax = 255;
int FANpin = 5;
boolean firstRun = true;
char* myText[] = {"JonLee Cooler", "Checking FAN...", "Done... OK"};
int myTimers[] = {1000, 3000, 5000};
// Enable and initialize LCD
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void setup(void)
{
// Start up the library
sensors.begin();
// Setup rows and colums for LCD
lcd.begin(16, 2);
}
// Mainlopp, this function lopp for eternity, calling other functions, code or
// just freezing due to bad coding :/
void loop(void)
{
// Call startup function, checking voltage, fans, water and temp sensors
if (firstRun == true)
{
startUp();
firstRun = !firstRun;
}
// Call for temp function to mesure and print out values.
getTemp();
// Call for timerDelay for getting temperatur.
tempGetTimer();
}
// Startup function, checking all data and sensors.
void startUp()
{
lcdPrint(0, 0, 0);
//lcd.setCursor(0, 0);
//lcd.print("MADZerQ Cooling");
lcdPrint(0, 1, 1);
//lcd.setCursor(0, 1);
//lcd.print("Checking FAN...");
analogWrite(FANpin, fanSpeedMax);
delay(myTimers[2]);
analogWrite(FANpin, fanSpeedMin);
lcd.setCursor(0, 1);
lcd.print("DONE... OK");
delay(myTimers[2]);
lcd.clear();
}
// Temp mesurement function, collects temp data from dallas 1 wire interface
float getTemp()
{
lcd.setCursor(0, 0);
lcd.print("Getting Temp...");
sensors.requestTemperatures();
tempC = sensors.getTempCByIndex(0);
lcdWriter(tempC);
fanController(tempC);
}
// FAN controller function, starts or stop FANS connected if temp is to high.
void fanController(float fanTemp)
{
if (fanTemp >= fanTempMax)
{
lcd.setCursor(0, 0);
lcd.print("HOT! FAN rews up");
analogWrite(FANpin, fanSpeedMax);
}
else
{
lcd.setCursor(0, 0);
lcd.print("COLD! FAN slows");
analogWrite(FANpin, fanSpeedMin);
}
}
// function to write data to LCD display, this one writes tempvalues
void lcdWriter(float lcdTemp)
{
lcd.setCursor(0, 1);
lcd.print("Temp is:");
lcd.setCursor(9, 1);
lcd.print(lcdTemp);
lcd.setCursor(14, 1);
lcd.print("C");
}
// function to show timer countdown before next tempmesurement, will be removed in release version
void tempGetTimer()
{
delay(myTimers[1]);
lcd.setCursor(0, 0);
lcd.print("Waiting:");
lcd.setCursor(8, 0);
lcd.print(" ");
for (int t = 25; t > 0; t--)
{
if (t <= 9)
{
lcd.setCursor(9, 0);
lcd.print(" ");
lcd.setCursor(10, 0);
lcd.print(t);
}
else
{
lcd.setCursor(9, 0);
lcd.print(t);
}
lcd.setCursor(12, 0);
lcd.print("sec");
delay(myTimers[0]);
}
}
// Print function for LCD use...
void lcdPrint(int lcdRows, int lcdColums, int lcdText, float lcdTemp, boolean cls = false)
{
lcd.setCursor(lcdRows, lcdColums);
lcd.print(myText[lcdText]);
if (cls == true)
{
lcd.clear();
}
}