Expected primary-expression before 'INT'

Getting this response when trying to compile.
Expected primary-expression before 'INT'

I’m slow. What am I missing? What does this error mean?

int light = 0;

void setup() {
  Spark.variable("light", &light, int);
  pinMode(A7, INPUT);

void loop() {
  int reading = 0;
  reading = analogRead(A7);


In this case INT has to be capitalized, since it is a #defined macro and not the type as such.

1 Like


When I make that change to…
Spark.variable("light", &light, INT);
… that error goes away but now it says
App code was invalid

I’m looking into this issue now…

I tried it with the change to INT and it compiled for me. You are not setting the variable “light” to anything but zero.

So I moved my file light-sensor.ino into its own folder (as it was in the same directory as multiple .ino files) and restarted Spark Dev and the file now compiles fine. Not sure why that fixes it but noticed others had mentioned that as a possible solution.



It’s mentioned in the docs as well, over here. Glad you got it working regardless.