invalid digit "9" in octal constant arduino

1

I have a problem with my temperature measuring function.

#include "max6675.h"

int ktcSO = 8;
int ktcCS = 9;
int ktcCLK = 10;

MAX6675 ktc(ktcCLK, ktcCS, ktcSO);


void setup() 
{
  Serial.begin(9600);
  delay(500);
}

void loop() 
{
   Serial.print("Temperatura = "); 
   Serial.println((1,11679312453725*ktc.readCelsius())+(-0,00531623949317312*ktc.readCelsius()*ktc.readCelsius())+(0,0000975327598421513*ktc.readCelsius()*ktc.readCelsius()*ktc.readCelsius())+(-0,000000653954749797908*ktc.readCelsius()*ktc.readCelsius()*ktc.readCelsius()*ktc.readCelsius())-1,63915244051268);
   delay(1000);
}

It returns me the error: invalid digit "9" in octal constant that part of my Serial.println . How do I solve it?

    
asked by anonymous 31.01.2018 / 16:37

1 answer

5

Arduino uses C / C ++ programming languages and, in their syntax, a float number is defined using dot, not comma. For example:

float pi_correto = 3.14 /* correto */
float pi_errado = 3,14 /* incorreto */

You are getting this error message because a number starting with 0 is interpreted by the compiler as a number in base 8 (that is, an octal number).

    
31.01.2018 / 17:09