Pre-built templates? Examples?

edited April 2016 in Kinoma Coding

Just generated a new project using the "KinomaJS Application with BLL" template. Are there any tutorials or examples that use these templates as a starting point? I didn't find anything that looks like this code in the examples, and am wondering what I may be missing from this template. For example, I noticed the template doesn't include a line like this:

var Pins = require("pins");

http://kinoma.com/develop/documentation/kinomajs-tutorials/pins-module/#using-the-pins-module-to-interact-with-sensors-configure-invoke-repeat-close-adding-the-pins-module-to-your-project

The docs say that this line is required if you want to use pins in your project, but the require line is not included in the generated template. Are there any other items missing from the template? At this point all I want to do is initialize some pins and send power to an LED, but I'm struggling with even this simple task. There's not much in the way of log output or indications of where things are going wrong.

Comments

  • Sorry for the confusion here--the BLL template doesn't use the Pins module. Instead it uses the older syntax as described in this document. I'll get that updated.

    In the meantime, here is a template for a KinomaJS app with a BLL that looks more like our samples and uses the Pins module syntax: https://github.com/lprader/KinomaJS-template-with-BLL

  • Thanks, Lizzie!

  • Is the newer syntax recommended? Which templates are best for a new user to use or standardize upon? Or is it better to write from scratch?

  • Yes, the Pins module documentation was just updated on Friday afternoon and now has a note at the top recommending it :) The syntax is much cleaner, and all of our sample apps use it so it will make it much easier to copy and paste code from those.

    If you're writing an app for Kinoma Create that uses a sensor, I recommend building on that template or one of our samples since the directories are already set up. You can read about why there are device and simulator folders here.

  • How do the 'old' style syntax know to create simulated pins? For example when I run this code the simulator pops up an analog slider that you can use to move the temperature sensor up and down:

    https://github.com/Kinoma/KPR-examples/tree/master/analog-temperature

  • See the link above about device and simulator folders from my last comment. You define the simulator BLLs yourself.

Sign In or Register to comment.