relatively new to programming here, but understand the basics.
I have some code I used successfully in Arduino IDE. Starts in main, calls another function called furnaceRelay passing the variables setTemperature, temperatureC, furnaceSwitch and relayPin. When I re-typed it in PlatformIO (VisualCode), I get the "not declared in this scope" errors. I assumed it was a formatting thing (I forgot open or close {} somewhere, but can't seem to find it.
I've declared my variables, and declared the functions in main.cpp,
Function Declared before void Setup:
void furnaceRelay(float setTemperature, float temperatureC, unsigned long furnaceSwitch, int relayPin);
Declared the variables here
float temperatureC;
float setTemperature = 19;
unsigned long furnaceSwitch;
int relayPin;
Then called the function here:
furnaceRelay(setTemperature, temperatureC, furnaceSwitch, relayPin);
And this is the function called:
void furnaceRelay(float setTemperature, float temperatureC, unsigned long furnaceSwitch, int relayPin)
{
if ((temperatureC + 1) > setTemperature)
{
//Serial.println("Furnace Off");
furnaceSwitch = millis();
digitalWrite(relayPin, LOW);
}
if ((temperatureC - 1) < setTemperature)
{
//Serial.println("Furnace On");
furnaceSwitch = millis();
digitalWrite(relayPin, HIGH);
}
return;
}
The errors I get is:
identifier millis is undefined millis was not declared in this scope identifier digitalWrite is undefined LOW was not declared in this scope identifier LOW is undefined digitalWrite was not declared in this scope identifier millis is undefined millis was not declared in this scope identifier digitalWrite is undefined HIGH was not declared in this scope identifier HIGH is undefined digitalWrite was not declared in this scope
I'm stumped. I'm pretty sure all my {} are there, what else am I missing?