Hello All,
got my Spark recently and have done some playing with Tinker, built the initial Blink firmware with Build and was able to flash that to my core successfully. Now I am trying to flash my own firmware onto the core, but am getting the following error when I validate -
…/ec89def10abc5d1530f956bf80bc46ed2b9f22e098871e2c0cd24c3d7144/the_user_app.cpp: In function ‘void setup()’:
…/ec89def10abc5d1530f956bf80bc46ed2b9f22e098871e2c0cd24c3d7144/the_user_app.cpp:21:42: error: invalid conversion from ‘void ()(int)’ to 'int ()(String)’ [-fpermissive]
In file included from …/inc/spark_wiring.h:31:0,
from …/inc/application.h:29,
from …/ec89def10abc5d1530f956bf80bc46ed2b9f22e098871e2c0cd24c3d7144/the_user_app.cpp:2:
…/inc/spark_utilities.h:73:14: error: initializing argument 2 of ‘static void SparkClass::function(const char*, int (*)(String))’ [-fpermissive]
make: *** […/ec89def10abc5d1530f956bf80bc46ed2b9f22e098871e2c0cd24c3d7144/the_user_app.o] Error 1
the code of my firmware is inlined below -
int LED_ONE = D0;
int LED_TWO = D1;
int LED_THREE = D2;
bool LED_ONE_LIT = false;
bool LED_TWO_LIT = false;
bool LED_THREE_LIT = false;
int lightlevel = 0;
void setup() {
pinMode(LED_ONE, OUTPUT);
pinMode(LED_TWO, OUTPUT);
pinMode(LED_THREE, OUTPUT);
Spark.function("toggleLed", toggleLed);
Spark.variable("lightlevel", &lightlevel, INT);
pinMode(A0, INPUT);
}
void loop() {
lightlevel = analogRead(A0);
}
void toggleLed(int led){
switch(led){
case 1:
LED_ONE_LIT == true ? LED_ONE_LIT = true : LED_ONE_LIT = false;
LED_ONE_LIT == true ? digitalWrite(LED_ONE, HIGH) : digitalWrite(LED_ONE, LOW);
break;
case 2:
LED_TWO_LIT == true ? LED_TWO_LIT = true : LED_TWO_LIT = false;
LED_TWO_LIT == true ? digitalWrite(LED_TWO, HIGH) : digitalWrite(LED_TWO, LOW);
break;
case 3:
LED_THREE_LIT == true ? LED_THREE_LIT = true : LED_THREE_LIT = false;
LED_THREE_LIT == true ? digitalWrite(LED_THREE, HIGH) : digitalWrite(LED_THREE, LOW);
break;
}
}
I get the same results on both Safari and Firefox (Mac OS X 10.8.5).
Am I missing something here?
TIA for any help.