// ------------------------------------------------------------- // R+ connect SDA // R-SCL // ------------------------------------------------------------- task main() { bool Rbutton, Lbutton, Mbutton; UseRS485(); // (1) Port S4 configured for RS485 RS485Enable(); // (2) turn on RS485 //RS485Uart(HS_BAUD_57600, HS_MODE_DEFAULT); // (3) initialize UART 57600 RS485Uart(HS_BAUD_115200, HS_MODE_DEFAULT); Wait(100); TextOut(0, LCD_LINE1, " NXT <> laptop"); while (true) { if(ButtonPressed(BTNRIGHT, FALSE)){ // if Right Button is pressed while(ButtonPressed(BTNRIGHT, FALSE)); // Wait for Button is released SendRS485String(" Right "); // then send string } else if(ButtonPressed(BTNLEFT, FALSE)){ while(ButtonPressed(BTNLEFT, FALSE)); SendRS485String(" Left "); } else if(ButtonPressed(BTNCENTER, FALSE)){ while(ButtonPressed(BTNCENTER, FALSE)); SendRS485String(" Center "); } } }