Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Electric Imp imp API uart.configure() example 2
local serial = null;
// Set 'serial' according to imp type
switch (imp.info().type) {
case "imp001":
case "imp002":
serial = hardware.uart57;
break;
case "imp003":
serial = hardware.uartFG;
break;
case "imp004m":
serial = hardware.uartHJ;
break;
case "imp005":
serial = hardware.uart0;
break;
default:
// Unknown imp
throw("Unknown imp type detected");
}
// Configure 'serial'
serial.configure(19200, 8, PARITY_EVEN, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment