benwa
February 26, 2015, 4:33am
1
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);
}
Thanks.
ScruffR
February 26, 2015, 4:43am
2
In this case INT
has to be capitalized, since it is a #defined
macro and not the type as such.
1 Like
benwa
February 26, 2015, 4:49am
3
Thanks.
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…
bko
February 26, 2015, 4:55am
4
I tried it with the change to INT
and it compiled for me. You are not setting the variable “light” to anything but zero.
benwa
February 26, 2015, 4:55am
5
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.
Thanks!
2 Likes
Moors7
February 26, 2015, 5:08am
6
It’s mentioned in the docs as well, over here . Glad you got it working regardless.
2 Likes