Exception: configurationToMux: in: no reference! - What does it mean?

edited April 2016 in Kinoma Coding

I'm trying to build some sample code, similar to the existing examples, that utilizes the Sparkfun SEN-13322 soil moisture sensor. The app launches but then throws this error right away.

Exception: configurationToMux: in: no reference!

The code in question is in my fork here:

https://github.com/scarolan/KPR-examples/tree/master/analog-soil-moisture

Can anyone spot what's wrong?

Answers

  • edited April 2016

    That error message means there's a problem with your pin configuration code. A few problems I see:

    1) Like I mentioned in one of your other discussion threads, we recommend using the newer Pins module syntax as in the template I provided. Right now you use the newer syntax in the onDisplayed function of HumBehavior, but also have the old messaging style in the application's onLaunch function. There's no need to use both, so you should take out this chunk:

     application.invoke(new MessageWithObject("pins:configure", {
        sensor: {
            require: "bll",
                pins: {
                   soilmoisture: {pin: 52}
               }
    }}), Message.TEXT);
    

    Also--in that chunk you require the module "bll.js" but in your call to Pins.configure you use the compact configuration described in the Pins module documentation, which uses the built-in analog BLL. For a simple project like this where you simply want to read the value from the sensor, that will be fine. You can read more about the built-in analog BLL on this page. There's also an analog-temperature sample that could be a good starting point for you.

    2) As the Pins module documentation states, you should use the type "Analog," rather than "A2D". You'll need to change that in your main.js and BLLs.

    3) When you call Pins.repeat the path should be the name specfied in the pins object passed into Pins.configure. Right now you have

    Pins.repeat("/A2D/read", 20, value => this.onA2DChanged(label, value));
    

    but the name you provided is "soilmoisture" so it should be

    Pins.repeat("/soilmoisture/read", 20, value => this.onA2DChanged(label, value));
    


    Hope this helps!

  • Thanks, your suggestions fixed the problem and the application works now. I only put this line in:

    application.add(humLabel);

    because nothing was appearing on the screen until I did so.

    If I wanted to do the right thing, and use the newer syntax instead how does one make it work? I fiddled with it for a couple hours and couldn't get it going.

    Also, is there any way to get a full stack trace when there are errors like the one I got?

  • Updated, working code here. albeit with the 'old' syntax. How do you get it working with the new syntax?

    https://github.com/scarolan/KPR-examples/tree/master/analog-soil-moisture

  • edited April 2016 Answer ✓

    Sorry, I should clarify my wording :) By 'old syntax' I mean the system that uses KinomaJS Messages, i.e.

    application.invoke(new MessageWithObject("pins:configure",...))
    

    The Pins module, which your application now uses is the 'new syntax'. So you are using the new syntax.

  • Thanks Lizzie! I super appreciate your help. Now to go test this thing in the garden...

Sign In or Register to comment.