Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function initUart()
- {
- hardware.configure(UART_57); // Using UART on pins 5 and 7
- hardware.uart57.configure(19200, 8, PARITY_NONE, 1, NO_CTSRTS, pollUart); //Setting up a channel between Arduino and EI
- }
- // UART polling function.
- function pollUart()
- {
- local s = "";
- local byte = hardware.uart57.read();
- while(byte != -1) {
- s+=byte.tochar();
- byte = hardware.uart57.read();
- server.log("reading byte");
- }
- if(s.len())server.show(s);
- if(s.len())server.log(s);
- }
- function watchdog() {
- imp.wakeup(5*60, watchdog);
- server.log("watchdog");
- }
- // Executing the functions
- imp.configure("RobotWireless", [Coordinate("Coordinates")], []);
- initUart(); // Initialize the UART, called just once
- watchdog();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement