Quasics2019Code/HedyLamarr/src/main/cpp/Subsystems/Lighting.cpp
// Sends the specified command out (via broadcast) to the Arduino.

Sends the specified command out (via broadcast) to the Arduino.
Sends the specified command out ( via broadcast ) to the Arduino .
bool Lighting::sendCommandToArduino(const std::string &cmd) {
  if (udpSocket == -1) {
    std::cerr << "Warning: Can't send '" << cmd << "' to Arduino (no socket)\n";
    return false;
  }
  const int bytesToSend = cmd.length() + 1;
  return (sendto(udpSocket, cmd.c_str(), bytesToSend, 0,
                 reinterpret_cast<const sockaddr *>(&broadcastAddress),
                 sizeof(broadcastAddress)) == bytesToSend);
}
bool Lighting :: sendCommandToArduino ( const std :: string & cmd ) { if ( udpSocket == -1 ) { std :: cerr << " " << cmd << " \n " ; return false ; } const int bytesToSend = cmd . length ( ) + 1 ; return ( sendto ( udpSocket , cmd . c_str ( ) , bytesToSend , 0 , reinterpret_cast < const sockaddr * > ( & broadcastAddress ) , sizeof ( broadcastAddress ) ) == bytesToSend ) ; }
Sends the specified command out (via broadcast) to the Arduino.
Sends the specified command out ( via broadcast ) to the Arduino .