String of numbers

I have my code working well, only one issue. When my Impee sends a number (629), planner and the log show it as three separate numbers (6, 2, 9) on separate lines. Not sure what i have wrong, i think it is with the UART somewhere. Here is my code: By the way I am loving Imp so far!

// impeeIn will override the InputPort class.
// Whenever data is received to the impee, we’ll jump into the set© function defined within
class impeeIn extends InputPort
name = “UART Out”;
type = “number”;

function set(c)


local impeeInput = impeeIn(); // assign impeeIn class to the impeeInput
local impeeOutput = OutputPort(“UART In”, “number”); // set impeeOutput as a string

function initUart()
hardware.configure(UART_57); // Using UART on pins 5 and 7
hardware.uart57.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS); // 19200 baud deault, no parity, 1 stop bit, 8 data bits

// UART polling function.
function pollUart()
imp.wakeup(0.1, pollUart.bindenv(this)); // schedule the next poll in 10us

local byte =;    // read the UART buffer
// This will return -1 if there is no data to be read.
while (byte!= -1)  // otherwise, we keep reading until there is no data to be read.
    //server.log(format("%c", byte)); // send the character out to the server log. Optional, great for debugging"%c", byte));
    impeeOutput.set(byte);  // send the valid character out the impee's outputPort
    byte =;  // read from the UART buffer again (not sure if it's a valid character yet)


// impee config
imp.configure(“PSIG”, [impeeInput], []);
initUart(); // Initialize the UART, called just once
pollUart(); // start the UART polling, this function continues to call itself
// End

Each call to (or output.set) replaces the previously-shown data. Each call to server.log starts a new line in the log. If you want the three characters “6”, “2”, and “9” to appear in a single output string, or a single log line, you’ll have to concatenate them together yourself, something like this:
local s = ""; local byte =; while (byte != -1 && s.len() < 100) { s = s + format("%c", byte); byte =; }; impeeOutput.set(s);


Worked very well thank you!