I am trying to get a serial input that is being recieved through the imp to a COSM node. However, with my code, even after I have declaered an output port in my code, it still says that I have no output ports when I try to connect the two nodes. In short, I can not get output ports in nodes to work with my code. Help! The code is below. Any suggestions?
hardware.uart12.configure(38400, 8, PARITY_NONE, 1, NO_CTSRTS);
local result = OutputPort(“air_quality”);
function readSerial() {
hardware.uart12.write(0xC0);
imp.sleep(0.1);
local result = hardware.uart12.read();
if (result == -1) {
server.show(“No data returned.”);
} else {
server.show(result);
}
imp.wakeup(300, readSerial);
}
imp.configure(“Serial RX”, [], []);
readSerial();
result.set(result);