Spark Core App in iOS 8 - Tinker gets the 404 error with any command. Can’t re-flash Tinker as app will crash every time. The app see my core as Online (green dot). I can flash from the online Particle Build and the program runs fine on the Core. I’ve reloaded the app on the phone. I’ve done the factory reset. However, the Spark Core App will never connect. I have to use Terminal to get the core back online (cyan breathing flash). So I’ve done everything suggest here in the forum that I can find to no avail. Anyone have fresh idea?
If you have a dual band router (like the recent Apple routers) try changing the SSID of the 5GHz part so you can be sure you are on the “right” network-the 2.4GHz network.
Lots of recent high end routers try to promote hosts to the 5GHz band but the TI setup code can’t work across the bands.
Sorry guys, I can find these files but I don’t know how to use them to flash…with what program and how. Guess I need to be an experienced programmer to get this core back working from Tinker.
they are software that can be installed easily and a programmer is not required.
Alternatively, paste this code in WEB IDE and flash it:
/* Function prototypes -------------------------------------------------------*/
int tinkerDigitalRead(String pin);
int tinkerDigitalWrite(String command);
int tinkerAnalogRead(String pin);
int tinkerAnalogWrite(String command);
SYSTEM_MODE(AUTOMATIC);
/* This function is called once at start up ----------------------------------*/
void setup()
{
//Setup the Tinker application here
//Register all the Tinker functions
Spark.function("digitalread", tinkerDigitalRead);
Spark.function("digitalwrite", tinkerDigitalWrite);
Spark.function("analogread", tinkerAnalogRead);
Spark.function("analogwrite", tinkerAnalogWrite);
}
/* This function loops forever --------------------------------------------*/
void loop()
{
//This will run in a loop
}
/*******************************************************************************
* Function Name : tinkerDigitalRead
* Description : Reads the digital value of a given pin
* Input : Pin
* Output : None.
* Return : Value of the pin (0 or 1) in INT type
Returns a negative number on failure
*******************************************************************************/
int tinkerDigitalRead(String pin)
{
//convert ascii to integer
int pinNumber = pin.charAt(1) - '0';
//Sanity check to see if the pin numbers are within limits
if (pinNumber< 0 || pinNumber >7) return -1;
if(pin.startsWith("D"))
{
pinMode(pinNumber, INPUT_PULLDOWN);
return digitalRead(pinNumber);
}
else if (pin.startsWith("A"))
{
pinMode(pinNumber+10, INPUT_PULLDOWN);
return digitalRead(pinNumber+10);
}
return -2;
}
/*******************************************************************************
* Function Name : tinkerDigitalWrite
* Description : Sets the specified pin HIGH or LOW
* Input : Pin and value
* Output : None.
* Return : 1 on success and a negative number on failure
*******************************************************************************/
int tinkerDigitalWrite(String command)
{
bool value = 0;
//convert ascii to integer
int pinNumber = command.charAt(1) - '0';
//Sanity check to see if the pin numbers are within limits
if (pinNumber< 0 || pinNumber >7) return -1;
if(command.substring(3,7) == "HIGH") value = 1;
else if(command.substring(3,6) == "LOW") value = 0;
else return -2;
if(command.startsWith("D"))
{
pinMode(pinNumber, OUTPUT);
digitalWrite(pinNumber, value);
return 1;
}
else if(command.startsWith("A"))
{
pinMode(pinNumber+10, OUTPUT);
digitalWrite(pinNumber+10, value);
return 1;
}
else return -3;
}
/*******************************************************************************
* Function Name : tinkerAnalogRead
* Description : Reads the analog value of a pin
* Input : Pin
* Output : None.
* Return : Returns the analog value in INT type (0 to 4095)
Returns a negative number on failure
*******************************************************************************/
int tinkerAnalogRead(String pin)
{
//convert ascii to integer
int pinNumber = pin.charAt(1) - '0';
//Sanity check to see if the pin numbers are within limits
if (pinNumber< 0 || pinNumber >7) return -1;
if(pin.startsWith("D"))
{
pinMode(pinNumber, INPUT);
return analogRead(pinNumber);
}
else if (pin.startsWith("A"))
{
pinMode(pinNumber+10, INPUT);
return analogRead(pinNumber+10);
}
return -2;
}
/*******************************************************************************
* Function Name : tinkerAnalogWrite
* Description : Writes an analog value (PWM) to the specified pin
* Input : Pin and Value (0 to 255)
* Output : None.
* Return : 1 on success and a negative number on failure
*******************************************************************************/
int tinkerAnalogWrite(String command)
{
//convert ascii to integer
int pinNumber = command.charAt(1) - '0';
//Sanity check to see if the pin numbers are within limits
if (pinNumber< 0 || pinNumber >7) return -1;
String value = command.substring(3);
if(command.startsWith("D"))
{
pinMode(pinNumber, OUTPUT);
analogWrite(pinNumber, value.toInt());
return 1;
}
else if(command.startsWith("A"))
{
pinMode(pinNumber+10, OUTPUT);
analogWrite(pinNumber+10, value.toInt());
return 1;
}
else return -2;
}
Thank you very much for hanging in there with me. I appreciate your time. That IDE code worked and now my iOS app works again. Now I can get started learning and making some things work or not. This code will probably help the others out there that I’ve read here with that same “404” error when using Tinker. I’m still puzzled why the app never shows the “reflash Tinker” BUT that is a minor thing now that I can move forward.
Maybe I am misunderstanding something here. I ran the IDE flash and Tinker then works. However, if I load/flash any other program I write to the core, Tinker no longer works. This doesn’t seem a solution or is Tinker only for demonstration purposes. Confused again…
Be sure to use all the great recommendations people have suggested.
We do plan to add a “re-flash tinker” feature to the new iOS Particle app quite soon - it will work both for Cores and Photons!
Particle app V1.2 for iOS should be available in few days (waiting for Apple approval) - that includes Tinker for Photons and Cores, next app version 1.3 will probably include the re-flash tinker feature you request.
I should mention that the old “Spark Core” app is no longer supported or maintained.
Thanks again. It’s funny but I had a thought, when I realized that I needed to run that code each time, that I might integrating my code into the flash code. But didn’t think that would work. And it turns out to be just that.
I appreciate how quickly and patient you reply. If I didn’t have to work or pay attention to family I’d make real progress… LOL
The above looks somewhat like what I’m experiencing. Namely I was using Tinker for a couple learnings, then flashed a sample program (Morse Code) and got it working. Now, when I go back to the Particle App on my iP6, it goes directly to “Your Devices”. Clicking my Photon only displays Mac, last connect and IP. How do I get back to Tinkering?
I don’t know how the iOS app exactly works, but with the Android App you can click on the device and then have a tripple-dot ( … ) menu where you can find extra options/actions and one of them is Re-flash Tinker
This is the screenshot of the iOS app in the store that shows what I mean (underneath the battery symbol)