/* -------------------------------------------------------------------- */ void verbosebaud(void) { char c, f = 0; long t; if (debug) outCon('['); t = cit_timer(); while (gotCarrier() && cit_timer() < (t + 6) && !KBReady()) { if (MIReady()) { c = (char) getMod(); } else { c = 0; } if (debug && c) { outCon(c); } if (f) { switch (c) { case '\n': case '\r': /* CONNECT */ baud(0); if (debug) outCon(']'); return; case '1': /* CONNECT 1200 */ baud(1); if (debug) outCon(']'); return; case '2': /* CONNECT 2400 */ baud(2); if (debug) outCon(']'); return; case '4': /* CONNECT 4800 */ baud(3); if (debug) outCon(']'); return; case '9': /* CONNECT 9600 */ baud(4); if (debug) outCon(']'); return; default: break; } } if (c == 'C') { if (debug) { outCon('@'); } f = 1; } } }
QVariantMap NetworkManager::SerialSetting::toMap() const { QVariantMap setting; if (baud() != 57600) { setting.insert(QLatin1String(NM_SETTING_SERIAL_BAUD), baud()); } if (bits() != 8) { setting.insert(QLatin1String(NM_SETTING_SERIAL_BITS), bits()); } if (parity() != NoParity) { if (parity() == EvenParity) { setting.insert(QLatin1String(NM_SETTING_SERIAL_PARITY), 'E'); } else if (parity() == OddParity) { setting.insert(QLatin1String(NM_SETTING_SERIAL_PARITY), 'o'); } } if (stopbits() != 1) { setting.insert(QLatin1String(NM_SETTING_SERIAL_STOPBITS), stopbits()); } if (sendDelay()) { setting.insert(QLatin1String(NM_SETTING_SERIAL_SEND_DELAY), sendDelay()); } return setting; }
BufferedSerial::BufferedSerial(PinName tx, PinName rx, int baud_rate, uint32_t buf_size) : RawSerial(tx, rx) , _rxbuf(buf_size), _txbuf(buf_size), _buffered_bytes(0), rxCallback(NULL) { baud(baud_rate); RawSerial::attach(this, &BufferedSerial::rxIrq, Serial::RxIrq); this->_buf_size = buf_size; }
int carrier(void) { unsigned char c; if ( /* (whichIO==MODEM) && */ (c = (uchar) gotCarrier()) != modStat && (!detectflag) ) { /* carrier changed */ if (c) { /* carrier present */ switch (cfg.dumbmodem) { case 0: /* numeric */ /* do not use this routine for carrier detect */ return (1); case 1: /* returns */ if (!findbaud()) { Initport(); return TRUE; } break; case 2: /* HS on RI */ ringdetectbaud(); break; case 3: /* verbose */ verbosebaud(); break; default: case 4: /* forced */ baud(cfg.initbaud); break; } if (!onConsole) { carrdetect(); detectflag = FALSE; return (0); } else { detectflag = TRUE; /* update25(); */ do_idle(0); return (1); } } else { delay(2000); /* confirm it's not a glitch */ if (!gotCarrier()) {/* check again */ carrloss(); return (0); } } } return (1); }
int _tmain(int argc, _TCHAR* argv[]) { std::string prt(argv[1]); std::string baud(argv[2]); std::string port(prt.begin(), prt.end()); SerialWriter serialWriter(port); if(serialWriter.ser.is_open() ==false) return-1; return serialWriter.loop(); }
// Declare Global variables int main(void) { // Set up Create and module initializeCommandModule(); powerOnRobot(); // Is the Robot on byteTx(CmdStart); // Start the create baud(Baud57600); // Set the baud rate for the Create and Command Module defineSongs(); // Define some songs so that we know the robot is on. byteTx(CmdControl); // Deprecated form of safe mode. I use it because it will // turn of all LEDs, so it's essentially a reset. byteTx(CmdFull); // We are operating in FULL mode. // Play the reset song and wait while it plays. byteTx(CmdPlay); byteTx(RESET_SONG); delayMs(750); // Turn the power button on to something. turnOnPowerButtonLight(); delayMs(20); // Infinite operation loop int timerLoop = 0; const int timerLimit = 15; initializeUSBBuffer(); initializeRobotBuffer(); initializeSensorArray(); setLEDs(BOTHLED, FULL); enableReports(); enableSensors(); while(1) { pollSensors(); if(timerLoop == timerLimit){ compileReport(); sendUSBBuffer(); timerLoop = 0; delayMs(1); } timerLoop++; pollRemoteSensors(); pollRemote(); executeCommand(); delayMs(5); } }
// Declare Global variables int main(void) { // Set up Create and module initializeCommandModule(); powerOnRobot(); // Is the Robot on byteTx(CmdStart); // Start the create baud(Baud57600); // Set the baud rate for the Create and Command Module defineSongs(); // Define some songs so that we know the robot is on. byteTx(CmdControl); // Deprecated form of safe mode. I use it because it will // turn of all LEDs, so it's essentially a reset. byteTx(CmdFull); // We are operating in FULL mode. // Play the reset song and wait while it plays. byteTx(CmdPlay); byteTx(RESET_SONG); delayMs(750); // Turn the power button on to something. delayMs(20); initializeUSBBuffer(); initializeRobotBuffer(); initializeSensorArray(); setLEDs(BOTHLED, FULL); enableReports(); enableSensors(); int fakeTimer = 0; // Infinite operation loop while(1) { if (fakeTimer == 4) { compileReport(); sendUSBBuffer(); fakeTimer = 0; } pollSensors(); delayMs(250); fakeTimer++; } }
/* -------------------------------------------------------------------- */ int findbaud(void) { char noGood = TRUE; int Time = 0; int baudRunner; /* Only try for 60 seconds */ while (MIReady()) getMod(); /* Clear garbage */ baudRunner = 0; while (gotCarrier() && noGood && Time < 120) { Time++; baud(baudRunner); noGood = checkCR(); if (noGood) baudRunner = (baudRunner + 1) % (3 /* 2400 too */); } return !noGood; }
bool USBHostSerial::connect() { if (dev_connected) { return true; } for (uint8_t i = 0; i < MAX_DEVICE_CONNECTED; i++) { if ((dev = host->getDevice(i)) != NULL) { USB_DBG("Trying to connect serial device\r\n"); if(host->enumerate(dev, this)) break; if (serial_device_found) { bulk_in = dev->getEndpoint(serial_intf, BULK_ENDPOINT, IN); bulk_out = dev->getEndpoint(serial_intf, BULK_ENDPOINT, OUT); if (!bulk_in || !bulk_out) break; USB_INFO("New Serial device: VID:%04x PID:%04x [dev: %p - intf: %d]", dev->getVid(), dev->getPid(), dev, serial_intf); dev->setName("Serial", serial_intf); host->registerDriver(dev, serial_intf, this, &USBHostSerial::init); baud(9600); size_bulk_in = bulk_in->getSize(); size_bulk_out = bulk_out->getSize(); bulk_in->attach(this, &USBHostSerial::rxHandler); bulk_out->attach(this, &USBHostSerial::txHandler); host->bulkRead(dev, bulk_in, buf, size_bulk_in, false); dev_connected = true; return true; } } } init(); return false; }
SerialCom::SerialCom(PinName tx, PinName rx) : BufferedSerial(tx, rx){ baud(115200); current_read_pos = 0; message_available = 0; }
bool IOSerial::open() { if (!m_fd) { struct termios tty; m_fd = ::open(m_device, O_RDWR | O_NOCTTY | O_NONBLOCK); if (m_fd < 0) { emit error(CouldNotOpen, strerror(errno)); m_fd = 0; return false; } tcgetattr(m_fd, &tty); /* Baud rate */ int speed = baud(m_baud); if (speed == -1) { emit error(Refuse, tr("Invalid baud rate")); return false; } cfsetospeed(&tty, speed); cfsetispeed(&tty, speed); /* Take care of Space / Mark parity */ if (m_dbits == 7 && (m_parity == ParitySpace || m_parity == ParityMark)) { m_dbits = 8; } /* Data bits */ switch (m_dbits) { case 5: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS5; break; case 6: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS6; break; case 7: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS7; break; case 8: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8; break; default: break; } /* Raw, no echo mode */ tty.c_iflag = IGNBRK; tty.c_lflag = 0; tty.c_oflag = 0; tty.c_cflag |= CLOCAL | CREAD; /* Stop bits */ if (m_sbits == 2) { tty.c_cflag |= CSTOPB; } else { tty.c_cflag &= ~CSTOPB; } tty.c_cc[VMIN] = 1; tty.c_cc[VTIME] = 5; /* Flow control */ if (m_flow & FlowSW) tty.c_iflag |= IXON | IXOFF; else tty.c_iflag &= ~(IXON|IXOFF|IXANY); if (m_flow & FlowHW) tty.c_cflag |= CRTSCTS; else tty.c_cflag &= ~CRTSCTS; /* Parity */ tty.c_cflag &= ~(PARENB | PARODD); if (m_parity & ParityEven) tty.c_cflag |= PARENB; else if (m_parity & ParityOdd) tty.c_cflag |= (PARENB | PARODD); /* Set the changes */ tcsetattr(m_fd, TCSANOW, &tty); /* Notifications on read & errors */ m_read = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); m_error = new QSocketNotifier(m_fd, QSocketNotifier::Exception, this); connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived())); connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); m_connected = false; return true; } else {
QVariantMap NetworkManager::PppSetting::toMap() const { QVariantMap setting; if (!noAuth()) { setting.insert(QLatin1String(NM_SETTING_PPP_NOAUTH), noAuth()); } if (refuseEap()) { setting.insert(QLatin1String(NM_SETTING_PPP_REFUSE_EAP), refuseEap()); } if (refusePap()) { setting.insert(QLatin1String(NM_SETTING_PPP_REFUSE_PAP), refusePap()); } if (refuseChap()) { setting.insert(QLatin1String(NM_SETTING_PPP_REFUSE_CHAP), refuseChap()); } if (refuseMschap()) { setting.insert(QLatin1String(NM_SETTING_PPP_REFUSE_MSCHAP), refuseMschap()); } if (refuseMschapv2()) { setting.insert(QLatin1String(NM_SETTING_PPP_REFUSE_MSCHAPV2), refuseMschapv2()); } if (noBsdComp()) { setting.insert(QLatin1String(NM_SETTING_PPP_NOBSDCOMP), noBsdComp()); } if (noDeflate()) { setting.insert(QLatin1String(NM_SETTING_PPP_NODEFLATE), noDeflate()); } if (noVjComp()) { setting.insert(QLatin1String(NM_SETTING_PPP_NO_VJ_COMP), noVjComp()); } if (requireMppe()) { setting.insert(QLatin1String(NM_SETTING_PPP_REQUIRE_MPPE), requireMppe()); } if (requireMppe128()) { setting.insert(QLatin1String(NM_SETTING_PPP_REQUIRE_MPPE_128), requireMppe128()); } if (mppeStateful()) { setting.insert(QLatin1String(NM_SETTING_PPP_MPPE_STATEFUL), mppeStateful()); } if (cRtsCts()) { setting.insert(QLatin1String(NM_SETTING_PPP_CRTSCTS), cRtsCts()); } if (baud()) { setting.insert(QLatin1String(NM_SETTING_PPP_BAUD), baud()); } if (mru()) { setting.insert(QLatin1String(NM_SETTING_PPP_MRU), mru()); } if (mtu()) { setting.insert(QLatin1String(NM_SETTING_PPP_MTU), mtu()); } if (lcpEchoFailure()) { setting.insert(QLatin1String(NM_SETTING_PPP_LCP_ECHO_FAILURE), lcpEchoFailure()); } if (lcpEchoInterval()) { setting.insert(QLatin1String(NM_SETTING_PPP_LCP_ECHO_INTERVAL), lcpEchoInterval()); } return setting; }
int main() { // Set up Create and module initializeCommandModule(); powerOnRobot(); // Is the Robot on byteTx(CmdStart); // Start the create baud(Baud57600); // Set the baud rate for the Create and Command Module defineSongs(); // Define some songs so that we know the robot is on. byteTx(CmdControl); // Deprecated form of safe mode. I use it because it will // turn of all LEDs, so it's essentially a reset. byteTx(CmdFull); // We are operating in FULL mode. // CSCE 274 students: I would make sure the robot stops. // As a precaution for the robot and your grade. //Doesn't need to stop for task 1 since it doesn't move. // Play the reset song and wait while it plays. byteTx(CmdPlay); byteTx(RESET_SONG); delayMs(750); // Turn the power button on to something. I like red, but here is green. // CSCE 274 students: The following should (will) be a function that you write. changePowerLightRed(); //power light now red // Initialize global variables uint8_t bumpbyte, bumpLeft, bumpRight; int rightLEDonInt = 0; int leftLEDonInt = 1; //call initial functions //setup LEDs setupRightLED(); setupLeftLED(); leftLEDon(); //start with left LED on // Infinite operation loop for(;;) { while (!bumpRight && !bumpLeft) { //no bumps //no bumps are rightLED on if (rightLEDonInt == 1 && leftLEDonInt == 0 && !bumpRight && !bumpLeft) { rightLEDoff(); rightLEDonInt = 0; leftLEDon(); leftLEDonInt = 1; } //no bumps and left LED on else if (rightLEDonInt == 0 && leftLEDonInt == 1 && !bumpRight && !bumpLeft) { rightLEDon(); rightLEDonInt = 1; leftLEDoff(); leftLEDonInt = 0; } //no bumps and LEDs off else if (rightLEDonInt == 0 && leftLEDonInt == 0 && !bumpRight && !bumpLeft) { rightLEDon(); rightLEDonInt = 1; }//no bumps and both LEDs on else if (rightLEDonInt == 1 && leftLEDonInt == 1 && !bumpRight && !bumpLeft) { leftLEDon(); leftLEDonInt = 1; } delayMs(100); //delay for tenth of a second //update bump sensors byteTx(CmdSensors); byteTx(SenOverC); bumpbyte = byteRx(); bumpRight = bumpbyte & (1 << 0); bumpLeft = bumpbyte & (1 << 1); } //update bump sensors again byteTx(CmdSensors); byteTx(SenOverC); bumpbyte = byteRx(); bumpRight = bumpbyte & (1 << 0); bumpLeft = bumpbyte & (1 << 1); //turn on LEDs according to bump sensors if (bumpRight) { rightLEDon(); rightLEDonInt = 1; } else { rightLEDoff(); rightLEDonInt = 0; } if (bumpLeft) { leftLEDon(); leftLEDonInt = 1; } else { leftLEDoff(); leftLEDonInt = 0; } delayMs(10); if(UserButtonPressed) { powerOffRobot(); exit(1); } } }
void Serial::begin(unsigned int baudrate) { baud(baudrate); }
// Declare Global variables int main(void) { // Set up Create and module initializeCommandModule(); powerOnRobot(); // Is the Robot on byteTx(CmdStart); // Start the create baud(Baud57600); // Set the baud rate for the Create and Command Module defineSongs(); // Define some songs so that we know the robot is on. byteTx(CmdControl); // Deprecated form of safe mode. I use it because it will // turn of all LEDs, so it's essentially a reset. byteTx(CmdFull); // We are operating in FULL mode. // Play the reset song and wait while it plays. byteTx(CmdPlay); byteTx(RESET_SONG); delayMs(750); // Turn the power button on to something. initializeSensors(); // Sets up sensors. delayMs(200); // Gives the robot time to process. allowDriving(); // Enables Driving. enableOrders(); // Enables driveOrders() initializePlanner(); // Sets up the planner. decidePlanState(); // Decide on an initial state of the planner. disableIntegral(); // Integral term only used for state MAKETURN. //int16_t speed = DRIVESPEED; // Standard speed. delayMs(500); // Gives the robot time to process all of the above before continuing. // Infinite operation loop while(1) { compileSensors(); // Build the sensor Struct. Automatic Polling. decidePlanState(); delayMs(50); // The above operations are time-consuming, so wait. switch (getPlanState()) { case FINDWALL: debugLEDOff(); delayMs(10); break; case REPOSITION: buildInfrared(); buoyLights(); doDocking(); break; case STOP: driveOrders(0, 0, 50); debugLEDOff(); delayMs(10); break; default: debugLEDOff(); // Turn on the lights. delayMs(10); break; } } }
/************************************************************************ * main() Initialize & start citadel ************************************************************************/ void main(int argc, char *argv[]) { int i, cfg_ctdl = FALSE; long b; char init_baud; static char prompt[92]; char *envprompt; cfg.bios = 1; cit_init_timer(); /* initialize cit_time() and cit_timer() */ cfg.attr = 7; /* logo gets white letters */ setscreen(); /* initialize screen system */ memset(&parm,0,sizeof(parm)); for (i = 1; i < argc; i++) { if (argv[i][0] == '/' || argv[i][0] == '-') { switch (tolower(argv[i][1])) { #ifndef ATARI_ST case 'd': /* DesqView/TopView */ parm.dv = 1; cPrintf("DesqView/TopView mode\n"); break; case 'b': /* baud rate (for shell) */ if (argv[i + 1]) { b = atol(argv[++i]); for (init_baud = 0; bauds[init_baud]; ++init_baud) if (bauds[init_baud] == b) { parm.baud = init_baud; cPrintf("Initial baud rate fixed at %ld\n", b); break; } } break; case 'm': parm.memcheck = !parm.memcheck; break; #endif case 'c': /* Configure system */ cfg_ctdl = TRUE; break; case 'p': /* pace output */ if (argv[i + 1]) { parm.pace = atoi(argv[++i]); cPrintf("Output pacing %d\n", parm.pace); } break; case 's': /* run in shell from another BBS (door). */ cPrintf("Shell mode\n"); parm.door = TRUE; break; /*#ifndef ATARI_ST*/ #ifndef FLOPPY case 'e': /* use EMS */ if (_OvrInitEms(0, 0, 0)) { cPrintf("EMS memory initialization failed!\n"); parm.ems = 1; } break; #endif /*#endif*/ case 'v': /* just do events */ parm.events = 1; break; /*#ifndef ATARI_ST*/ #ifndef FLOPPY case 'x': /* use exteneded memory */ if (_OvrInitExt(0, 0)) cPrintf("Extended memory initialization failed!\n"); parm.ext = 1; break; #endif /*#endif*/ case 'l': /* log in user */ if (argv[i + 1]) { parm.login = argv[++i]; cPrintf("Auto-login\n"); } break; case 'u': /* log in user */ if (argv[i + 1]) { parm.user = argv[++i]; cPrintf("Auto-login %s\n", parm.user); } break; default: cPrintf("\nUnknown commandline switch '%s'.\n", argv[i]); cPrintf("Valid DOS command line switches:\n"); cPrintf(" -b baud Starting baud rate (300-19200)\n"); cPrintf(" -c Read configuration files\n"); cPrintf(" -d DesqView/TopView\n"); #ifndef FLOPPY cPrintf(" -e Use EMS memory for overlays\n"); #endif cPrintf(" -l str Log in using initials;password in str\n"); cPrintf(" -m Memory check during idle time, start\n"); cPrintf(" -p num Set output pacing to num\n"); cPrintf(" -s Run as a shell from another BBS\n"); cPrintf(" -u 'name' Log in using specifed user name"); cPrintf(" -v Just run cron events\n"); #ifndef FLOPPY cPrintf(" -x Use extended memory for overlays (386/486 only!)\n"); #endif exit(1); } } } if (cfg_ctdl) /* force reconfigure? */ unlink("etc.tab"); logo(); /* prints out system logo */ if (cit_time() < 607415813L) { cPrintf("\n\nPlease set your time and date!\n"); exit(1); } /* set prompt for shells */ envprompt = getenv("PROMPT"); if (!envprompt) envprompt = "$p$g"; sprintf(prompt, "PROMPT=\r\nType EXIT to return to FredCit\r\n%s", envprompt); if (putenv(prompt)) { cPrintf("\n\nCan not set DOS prompt!\n"); delay (5000); } /* initialize citadel */ initCitadel(); if (parm.baud) { cfg.initbaud = parm.baud; baud(cfg.initbaud); } if (parm.door) { detectflag = 1; // carrier(); // if (haveCarrier) { // carrdetect(); // newCarrier = 1; /* make hello blurb show up */ // } } greeting(); sysReq = FALSE; if (cfg.f6pass[0]) ConLock = TRUE; if (parm.dv) { cfg.bios = 1; directvideo = 0; } if (parm.login) { normalizeString(parm.login); /* normalize string in environment */ login(parm.login,NULL); } else if (parm.user && !loggedIn) { normalizeString(parm.user); /* normalize string in environment */ if (findPerson(parm.user, &lBuf) != ERROR) login(lBuf.lbin,lBuf.lbpw); } /* read in door interface files */ if (parm.door) { readDoorFiles(0); } /* update25(); */ do_idle(0); /* install critical error handler */ harderr(cit_herror_handler); /* execute main command loop */ if (!parm.events) command_loop(); else { do_cron_loop(); } exitcitadel(); }
/* -------------------------------------------------------------------- */ void ringdetectbaud(void) { baud(ringdetect()); }
int main (void) { uint8_t leds_cnt = 99; uint8_t leds_state = 0; uint8_t leds_on = 1; int16_t turn_angle = 0; uint8_t turn_dir = 1; uint8_t turning = 0; uint8_t backing_up = 0; // Set up Create and module initialize(); LEDBothOff; powerOnRobot(); byteTx(CmdStart); baud(Baud28800); defineSongs(); byteTx(CmdControl); byteTx(CmdFull); // Stop just as a precaution patrol_room(0, RadStraight); // Play the reset song and wait while it plays byteTx(CmdPlay); byteTx(RESET_SONG); delayAndUpdateSensors(750); for(;;) { if(++leds_cnt >= 100) { leds_cnt = 0; leds_on = !leds_on; if(leds_on) { byteTx(CmdLeds); byteTx(LEDsBoth); byteTx(128); byteTx(255); LEDBothOff; } else { byteTx(CmdLeds); byteTx(0x00); byteTx(0); byteTx(0); LEDBothOn; } } delayAndUpdateSensors(10); if(UserButtonPressed) { // Play start song and wait byteTx(CmdPlay); byteTx(START_SONG); delayAndUpdateSensors(2813); // Drive around until a button or unsafe condition is detected while(!(UserButtonPressed) && (!sensors[SenCliffL]) && (!sensors[SenCliffFL]) && (!sensors[SenCliffFR]) && (!sensors[SenCliffR]) && (!sensors[SenChAvailable]) ) { // Keep turning until the specified angle is reached if(turning) { if(backing_up) { if((-distance) > 5) backing_up = 0; patrol_room(-200, RadStraight); } else { if(turn_dir) { if(angle > turn_angle) turning = 0; patrol_room(200, RadCCW); } else { if((-angle) > turn_angle) turning = 0; patrol_room(200, RadCW); } } } else if(sensors[SenBumpDrop] & BumpEither) // Check for a bump { // Set the turn parameters and reset the angle if(sensors[SenBumpDrop] & BumpLeft) turn_dir = 0; else turn_dir = 1; backing_up = 1; turning = 1; distance = 0; angle = 0; turn_angle = randomAngle(); // Play the bump song byteTx(CmdPlay); byteTx(BUMP_SONG); } else { // Otherwise, patrol_room straight patrol_room(300, RadStraight); } // Flash the leds in sequence if(++leds_cnt >= 10) { leds_cnt = 0; if(turning) { // Flash backward while turning if(leds_state == 0) leds_state = 4; else leds_state--; } else { if(leds_state == 4) leds_state = 0; else leds_state++; } if(leds_state == 0) { // robot Power LED Amber byteTx(CmdLeds); byteTx(0x00); byteTx(128); byteTx(255); LEDBothOff; } else if(leds_state == 1) { // Play LED on byteTx(CmdLeds); byteTx(LEDPlay); byteTx(0); byteTx(0); LEDBothOff; } else if(leds_state == 2) { // Advance LED on byteTx(CmdLeds); byteTx(LEDAdvance); byteTx(0); byteTx(0); LEDBothOff; } else if(leds_state == 3) { // Robot LEDs off, CM left LED on byteTx(CmdLeds); byteTx(0x00); byteTx(0); byteTx(0); LED2On; LED1Off; } else if(leds_state == 4) { // Robot LEDs off, CM right LED on byteTx(CmdLeds); byteTx(0x00); byteTx(0); byteTx(0); LED1On; LED2Off; } } // wait a little more than one robot tick for sensors to update delayAndUpdateSensors(20); } // Stop driving patrol_room(0, RadStraight); // Play end song and wait delayAndUpdateSensors(500); byteTx(CmdPlay); byteTx(END_SONG); delayAndUpdateSensors(2438); } } }