Thanks @chrisnet and @DanielBernard
Actually 99% of the credits has to go to for their own app - my humble contribution to this is that I changed the tinker_fragment.xml to accomodate the extra pins and LED symbol, to add some event listeners and tweak the analog output when selecting a color.
Together with a slightly tweaked Tinker firmware thatâs all it needed.
So Iâm not quite sure what @chrisnet more info I could give as âHowToâ. If you could specify what youâd be interested in in particular, Iâd be happy to share my admittedly little insight
As for the finalized version, Iâm near the finishing line and would appreciate any volunteers for testing it.
Just filed a PullRequest for the android-app - hope itâll be accepted.
To actually have it work with your Core, youâd need the provided firmware (for link see first post - filed PR for that too).
Edit: ExtTinker firmware works together with standard Tinker App, too.
Next possible extension might be to incorporate the camera of the phone to acquire some color that could get transmitted to the Core which sets the RGB-LED accordingly
Obviously there must be something about light that gets peoples attention (which is true for me at least ;- ) - great job you put that RGB-LED on the Core to start with.
And what goes around comes around in a positive way, too.
Please post here if your forked Tinker App gets approved for use. As far as How to. I have very little understanding with Java / Android API but, have been developing PHP / HTML for years as well as interfacing Arduino pin control via HTML.
Is there no way to access the Spark Core except via the Cloud API ? If so, how are hardware guys going to implement Spark Core control - âHire a Software Guyâ ?
Hi @spydrop,
glad to hear that there is some interest in this little project of mine
As for controlling the Core, how did you do it with the Arduinos?
Since the firmware sports TCP & UDP classes in addition to the Cloud API you should be able to do pritty much the same things as with Arduino + WiFi shield (I guess) - despite some possible âchildhoodâ glitches
The Cloud API should actually make things easier than building your own TCP/UDP logic.
And for wired control there should be no problem what so ever.
The Arduino ethernet library allows me to use HTML links to control pins inside a local network. Here is the code I am using on one Ethernet Shield. It is also possible with the Wireless library as well. I am just looking for a simple user interface to control pins on a spark core inside a local network for my customers to use.
Hi again,
as said in the other thread this can be done.
Have a look at TCPClient - not sure how stable this is at the moment (? @Dave, @zach, @satishgn ?)
The side effect of this would be that you loose cloud API support - unless you take care of Spark.connect()/Spark.disconnect()-ing yourself.
Unfortunately my Pull Request didn't get pulled, since it doesn't fit design standards and would create a gap between Android and iOS app functionality *) - that's fair enough.
The other reason that it would make the app harder to understand for beginners I can't quite follow.
However, if someone likes to test the app (APK) before taking up the task of building locally, just send my a PM.
*) years later that doesn't seem to matter anymore as we now do have multiple discrepancies between iOS and Android which won't fix anytime soon.
So, from what I gather is Spark Team has no intentions to support any HTML, or Java, or PHP, or Python control of the Spark Core via the cloud. Only Android & iOS are official options ?
@spydrop, I would not say that.
As you have seen there are several threads dealing with different ways to use the cloud to communicate with the Core - and the cloud is the official way, no matter what system you use on your side.
As I understand it, the Android and iOS Tinker apps together with the standard Tinker firmware are merely a nice and easy sample application to get playing a bit - to unpack your fresh Core, plug it in and immediatel see that it works - and this via the Internet.
For me the Android app was a nice entry point into Android programing - I hadnât done any real project before, just some âHello Worldâ
I agree but, maybe you can help me with curl to control more than one Digital Pin at the same time ?
Here is my real life example: with the help of others @Dave@kennethlimcp@BDub@bko & YOU as I copied code from your extended Tinker App. Using PHP & Curl to execute it from my browser.
SPARK IDE APP
#define MAGICSTOP_EVENT "MagicStopEvent";
void setup() {
//Register all the Tinker functions
Spark.function("digitalwrite", magicstopDigitalWrite);
}
void loop() {
}
int magicstopDigitalWrite(String command) {
bool value = 0;
int pinNumber = command.charAt(1) - '0';
if (!(
((command.startsWith("D"))
&& 0 <= pinNumber && pinNumber <= 7)
))
return -1;
if (command.substring(3, 7) == "HIGH")
value = 1;
else if (command.substring(3, 6) == "LOW")
value = 0;
else
return -1;
pinMode(pinNumber, OUTPUT);
digitalWrite(pinNumber, value);
return value;
}
<PHP CODE + CURL----âŚ>
<?php
$post_params['D7'] = 'HIGH';
$post_params['D6'] = 'LOW';
$ch = curl_init("https://api.spark.io/v1/devices/48ff6f065067555028091087/digitalwrite");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "access_token=my_access_token_here¶ms=$post_params");
$output = curl_exec($ch);
curl_close($ch);
echo $output;
___________________________________
**Above PHP Does not work - Access token not found.**
**Below PHP does work but, only one pin is controlled.**
__________________________________
<?php
$ch = curl_init("https://api.spark.io/v1/devices/48ff6f065067555028091087/digitalwrite");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "access_token=my_access_token_here¶ms=D7,HIGH");
$output = curl_exec($ch);
curl_close($ch);
echo $output;
?>
I and 95% of people who use micro-controllers are not programmers but, I am trying.
You can definitely update more than one pin at a time with a function. @ScruffR is right, and Tinker is meant to be a great starting point for your own custom applications, both on and off the Core. If youâre writing a PHP app, then this could also be a good time to write your own firmware for the core as well!
Iâm hoping to start a beta for the cloud after this sprint (in April). Iâm bummed that I havenât been able to release it yet, but we had a series of changes and tools we wanted to release first to make the local cloud easier to use. (CLI, making it easier to switch servers, keys, etc) â There are more details and a beta group list forming here: https://community.spark.io/t/where-is-the-source-code-for-the-cloud/1381
Despite little interest in this topic, Iâve just added support for alternative API servers (aka local cloud) and a legacy mode to my Android ExtTinkerApp.
By default the features that require ExtTinker firmware (RGB-LED & RX/TX pins) are hidden and the app behaves just like the original.
Per pin hide/reset options have been added to the pinMode display. Hide state and pinMode are stored across sessions.
Via SignUp/Login screens you can get to an âAlter Hostâ screen, where you can configure API URL scheme (https, http), host server name and host port. These settings are stored across sessions.
Since I have no local server (yet), I couldnât really test if the server config actually works
Any feedback would be much appreciated.
@kennethlimcp, that would be great.
If youâd like an debug APK rather than having to build it yourself for testing, I could PM you a download link, just as I did for @zachary, when fileing my first PR.