Noodle connectors not showing

Hi

I can’t get a + sign to appear on my impees in the planner. If I click and drag from the point where the + should be I get a noodle showing zeros and nothing happens, it doesn’t matter what code I’m running, no + appears. I’m trying to connect my imp to COSM.

The code I want to connect to COSM is

`
hardware.pin8.configure(ANALOG_IN);

hardware.uart12.configure(38400, 8, PARITY_NONE, 1, NO_CTSRTS);

CharactersInLCD <- 16;

// you can read the imp’s input voltage at any time with:
local voltage = hardware.voltage();
server.log(format(“Running at %.2f V”, voltage));

local lastRawValue = 0;

server.log(“Hardware Configured”);

function checkLDR() {
local rawValue = hardware.pin8.read();

if (math.abs(rawValue - lastRawValue) > 150) {
    lastRawValue = rawValue ;
    
    server.show(rawValue);

    hardware.uart12.write(12);         //sets the cursor to line 1 column 1
    hardware.uart12.write(format("Light val = %d",rawValue));
    
}
imp.wakeup(0.5, checkLDR);

}

server.log(“measure LDR”);
imp.configure(“read LDR”, [], []);

checkLDR();
`

I’ll try to help. I have used COSM for all of my projects so far

add this code to define an output port

LDR<- OutputPort("My ADC reading","number");

and change the imp configure line to add an output port

imp.configure("measure LDR", [], [LDR]);

inside the function you repeatedly call put

LDR.set(lastRawValue );

You will not be able to push to COSM every 0.5 seconds. Perhaps each 20 seconds. You may wish to have a second function and a second time period for COSM.

You can add a second node of the type “Show Input” that will display the value sent to COSM; just connect it to the same output port - you only have one so it should be straightforward.

Also if you look at the API topic “writing efficient Squirrel” you will find that global variables should be set like this.

lastRawValue <- 0;

hope this helps : )

Hi mjkuwp94

Thanks very much for your help, that works perfectly. I can set my wakeup to a larger value, it was only small so I could see a fast response in my LCD.

Thanks again, all the best

Dougie