invalid Digit "9" in octal Constant Arduino

Asked

Viewed 821 times

1

I have a problem with my temperature measurement 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 what part of my Serial.println. How do I resolve?

1 answer

5


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

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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.