I am new to the SPARK core and so far I have found it an interesting module to use. I have followed and implemented many of the tutorials and various threads and my SPARK is happily sending temperature information from a DS18B20 to a WEB page. I am competent to dangerous with the C. I am familiar with HTML coding via a text editor but scripting languages (python, java, perl) and the use of special procedures like JSON are my weakness. It appears that to make full use of the SPARK capabilities I need to master the WEB side of the project. Gathering the data is the easy part ( a few lines of C), displaying/using the data is much more difficult for me.
Does the collective have suggestions as to where I should start reading? Is there a âSPARK and the WEB for dummiesâ that would allow me to read and understand what the WEB/HTML/Script portion of the tutorials are doing (almost all code published is without imbedded comments). If you were teaching a C programmer how to write scripts to interface with the SPARK how or where would you start? I realize that this is like asking how do I build a bridge but friendly pointers and suggestions are appreciated.
Hi Phil, Glad to see others who are interested in HTML/Web access and/or control of Spark Core, HOWEVER, as you search the forum you will see my many posts that request the very things you suggest.
I suggested a Dummies for Spark Core and immediately informed that a very component technical writer is working on a Spark Core book (Not a Dummies book like I want to see).
I requested the support of a Web - HTML interface and I was told best to use the officially supported method. Java API. I was told its not safe to place your access_token in a webpage. So I figured out how to place the access_token (actual) in the core IDE firmware and use a variable in an webpage but, still no support for html control of spark core. (read this thread)
@BDub has a great htlm/java web application interface called remote start you should take a look at:
The collective feels that a lot of money was invested by the âCommunityâ to use the official way of API (Java - Android).
If a HTML web interface is used it is suggested that a PHP Proxy service be employed to conceal the access_token in curl get and post requests.
But, if you really want to get a feeling of how HTML will not be supported here read this whole topic thread:
I would be happy to collaborate with someone in developing a HTML Web Interface. I have done some work on this using HTML / Jquery â Access_token hidden in IDE Core Firmware â External java variable but, I am not a programmer of any type. I just know HTML, some css, some very basic java.
I am trying to locate some files that I was working on for another person. Let me know if you are interested in seeing my approach.
The magic keywords you need are REST API (not Java API). Any web framework or current programming language will have tutorials / libraries / support / guides for building web apps that interact with our REST Api.
We are actually working on wrappers and tutorials for a bunch of popular languages, but in the meantime, the web is full of awesome tutorials.
A couple of factual inaccuracies in your statement that Iâd like to point out. First, the scripts that you reference are Javascript, not Java. This is an important distinction; they are two completely separate languages, and Javascript is what basically every website uses.
It sounds like you believe that itâs odd that we donât support plain HTML and only support Javascript, but this is a false choice; Javascript is part of the web, and just about any interaction that you have with a website these days will include Javascript. Itâs simply a way to script behaviors based on your interaction with the website.
In addition, there are in fact some simple HTML interfaces, such as the ones that @Dave referenced in his articles, that have been created by the community.
Regarding concealing the access token, perhaps I should clarify here. Spark is a secure web service, and uses access tokens (like many APIs) to manage that security. These access tokens are essentially passwords to your account.
Therefore, if your application requires security, itâs important that you donât expose your access token.
However, if your application doesnât require any security, and you donât mind exposing your secure credentials, then you can go ahead and share your access token. This would basically amount to treating Spark like an unsecured service. I donât mean to sound judgey about that, for many applications itâs totally fine to use an unsecured service, and if the security is more annoying than it is helpful, then you can basically ignore it by using the access token wherever you want.
Annnnnnywaaaaaaaay⌠Welcome to the community! Weâre here to help!
I would recommend you starting on a web development tutorial, I have been enjoying Node.js lately, but everyone has their favorites. I would try one of those tutorials I linked earlier.
I would try this tutorial for reading a Spark variable with Javascript on web pageâit is pretty easy! The key is using the jquery Javascript library to do the heavy lifting for you.
@bko I have used your tutorials with great success. They are appreciated. The âproblemâ I have is that the WEB side of the solution contains a lot of functionality that I do not, yet, understand. The code I understand, what and why it is doing what it is doing. The HTML code is magic. I am looking for information of how to do what you easily do. I started to read the JavaScript tutorial from W3Schools.com but life got in the way so I wont get back to that until the weekend.
@Dave I hope to also take a look at node.js and see what that does as well. Thanks.
@PKeller A fantastic way to learn HTML/CSS/Javascript is Codecademy!
If you like to learn by doing, they have fantastic tutorials. You can get familiar with Javascript through Codecademy because itâs used as a front-end language (to do things like define what buttons do on a website), but itâs also used as a back-end language (thatâs Node.js), so itâs extremely versatile. Great place to start.