当前位置: 首页>>代码示例>>C++>>正文


C++ Serial::printf方法代码示例

本文整理汇总了C++中Serial::printf方法的典型用法代码示例。如果您正苦于以下问题:C++ Serial::printf方法的具体用法?C++ Serial::printf怎么用?C++ Serial::printf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Serial的用法示例。


在下文中一共展示了Serial::printf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: uip_debug_printbytes

/**
 * @brief
 * @note
 * @param
 * @retval
 */
void UIPDebug::uip_debug_printbytes(const uint8_t* data, uint8_t len) {
    for(uint8_t i = 0; i < len; i++) {
        pc.printf("%d", data[i]);
        if(i < len - 1)
            pc.printf(",");
    }
}
开发者ID:ubergeekNZ,项目名称:tracker,代码行数:13,代码来源:uip_debug.cpp

示例2: main

int main() {
    Serial *pc = new Serial(USBTX, USBRX);

    MBED_HOSTTEST_TIMEOUT(20);
    MBED_HOSTTEST_SELECT(serial_nc_tx_auto);
    MBED_HOSTTEST_DESCRIPTION(Serial NC TX);
    MBED_HOSTTEST_START("MBED_38");

    // Wait until we receive start signal from host test
    char c = pc->getc();
    delete pc;

    // If signal is correct, start the test
    if (c == 'S') {
      Serial *pc = new Serial(USBTX, NC);
      pc->printf("TX OK - Expected\r\n");
      wait(0.5);  // wait for characters to finish transmitting

      delete pc;

      pc = new Serial(NC, USBRX);
      pc->printf("TX OK - Unexpected\r\n");
      wait(0.5);  // wait for characters to finish transmitting
      delete pc;
    }

    while (1) {
    }
}
开发者ID:Archcady,项目名称:mbed-os,代码行数:29,代码来源:main.cpp

示例3: uip_debug_printconns

/**
 * @brief
 * @note
 * @param
 * @retval
 */
void UIPDebug::uip_debug_printconns(void) {
    for(uint8_t i = 0; i < UIP_CONNS; i++) {
        if(uip_debug_printcon(&con[i], &uip_conns[i])) {
            pc.printf("connection[");
            pc.printf("%d", i);
            pc.printf("] changed.\n");
        }
    }
}
开发者ID:ubergeekNZ,项目名称:tracker,代码行数:15,代码来源:uip_debug.cpp

示例4: btn_onpress

static void btn_onpress(void)
{
    /* attempt copy from box_challenge context
     * we know the context is properly aligned so we try to obtain a carbon copy
     * of its memory location */
    pc.printf("attempting to read the secret...");
    memcpy(&g_challenge, g_box_context, sizeof(g_challenge));
    pc.printf(" done\n\r");
}
开发者ID:JaredCJR,项目名称:uvisor-helloworld,代码行数:9,代码来源:btn.cpp

示例5: set_i2c_pointer

char set_i2c_pointer(char addr, char reg)
{
    if (i2c.write(addr) == 0)
    {
        if (DEBUG)
            pc.printf("Could not write device address (set_i2c_pointer)\r\n");
        return 0;
    }
    if (i2c.write(reg) == 0)
    {
        if (DEBUG)
            pc.printf("Could not write reg address (set_i2c_pointer)\r\n");
        return 0;
    }
    return 1;
}
开发者ID:Quadcopter-safety,项目名称:IMU-mbed-interface,代码行数:16,代码来源:sensor.cpp

示例6: print_board

void LED_board::print_board(){
   for(int i = 0; i < NUM_ROW; i++){
        for(int j = 0; j < NUM_COL; j++){
            pc.printf("row_buffer[%d][%d] = %x\r\n", i, j, row_buffer[i][j]);
        }
    }
}
开发者ID:ljasmine,项目名称:ese350,代码行数:7,代码来源:LED_board.cpp

示例7: iridiumLoop

/* This function tries to send the latest logging data over Iridium */
void iridiumLoop(const void *context) {
    char data_buffer[200];
    sprintf(data_buffer,"IRIDIUM: %s %.6f %.6f %.6f %lu %.6f %.6f %.6f %.6f %lu %hu %hu",
        date,latitude,longitude,altitude,precision,internal_temp,external_temp,pressure,power,
        encoded_chars,good_sentences,failed_checksums);
    int err = isbd.sendSBDText(data_buffer);
    if (err == ISBD_BUSY) {
        diagSerial.printf("IRIDIUM IS BUSY\r\n");
        return;
    }
    if (err != 0) {
        diagSerial.printf("sendReceiveSBDText failed: error ");
        diagSerial.printf("%d\n", err);
    }

}
开发者ID:bharad6,项目名称:arm_hab_controller,代码行数:17,代码来源:main.cpp

示例8: send_wnc_cmd

// Sets a global with failure or success, assumes 1 thread all the time
int send_wnc_cmd(const char * s, string ** r, int ms_timeout)
{
  static const char * rsp_lst[] = { "OK", "ERROR", NULL };
  int len;
  
  pc.printf("Send: %s\r\n",s);
  int res = mdm_sendAtCmdRsp(s, rsp_lst, ms_timeout, &wncStr, &len);
  *r = &wncStr;   // Return a pointer to the static string
      
  if (res >= 0)
  {
      pc.puts("[");
      pc.puts(wncStr.data());
      pc.puts("]\n\r");
      if (res > 0)
      {
          if (WNC_MDM_ERR != WNC_NO_RESPONSE)
            WNC_MDM_ERR = WNC_CMD_ERR;
          return -1;
      }
      else
          return 0;
  }
  else
  {
      WNC_MDM_ERR = WNC_NO_RESPONSE;
      pc.puts("No response from WNC!\n\r");
      return -2;
  }
}
开发者ID:DevinMui,项目名称:InternetOfToast,代码行数:31,代码来源:wnc_control.cpp

示例9: LWM2M_notification_init

/*
initialize the limits for LWM2M mode and set the state by reporting the first sample
set LWM2M_observing true or false depending on desired behavior
if LWM2M_observing is false, the sample won't be transmitted
*/
void LWM2M_notification_init()
{
    pc.printf("init\r\n");
    limits[0] = LWM2M_lt;
    limits[1] = LWM2M_gt;
    report_sample(get_sample());
    return;
}
开发者ID:connectIOT,项目名称:lwm2m-objects,代码行数:13,代码来源:LWM2M_resource.cpp

示例10: createSensor

/** SENSOR functions -----------------------------------------------------------------------------*/
void node::createSensor(PinName sensorPin, PinName voltageCtrl, int num)  //Create new ligths in the node.
{
    if (num <= 5) {
        mySensors[num - 1] = new sensor(sensorPin, voltageCtrl);
    } else {
        pc.printf("Sensor number %d is invalid", num);
    }
}
开发者ID:andycarle,项目名称:SanLeandroRepository,代码行数:9,代码来源:node.cpp

示例11: sensorVccOff

void node::sensorVccOff(int sensorNum)
{
    if (sensorNum <= 5) {
        return mySensors[sensorNum - 1]->sensorOff();
    } else {
        pc.printf("Sensor number %d is invalid", sensorNum);        
    }
}
开发者ID:andycarle,项目名称:SanLeandroRepository,代码行数:8,代码来源:node.cpp

示例12: sensorVccState

int node::sensorVccState(int sensorNum)
{
    if (sensorNum <= 5) {
        return mySensors[sensorNum - 1]->sensorState();
    } else {
        pc.printf("Sensor number %d is invalid", sensorNum);
        return 10000;
    }
}
开发者ID:andycarle,项目名称:SanLeandroRepository,代码行数:9,代码来源:node.cpp

示例13: _dirTest

void SDHandler::_dirTest() {
#if DEBUG_LOGGING
  std::string path = "/sd/";
  _filenames = _read_directory(path);
  for(vector<std::string>::iterator it = _filenames.begin(); it < _filenames.end(); it++) {
    BT.printf("%s\n", (*it).c_str());
  }
#endif
}
开发者ID:Mikk36,项目名称:gpsLogger,代码行数:9,代码来源:SDHandler.cpp

示例14: read

int read(char addr, char reg, char *buf, int n)
{
    i2c.start();
    if (set_i2c_pointer(addr, reg) == 0)
    {
        if (DEBUG)
            pc.printf("Could not set i2c pointer (read)\r\n");
        return 0;
    }
    if (i2c.read(addr|1, buf, n, true) != 0)
    {
        if (DEBUG)
            pc.printf("Could not execute read sequence (read)\r\n");
        return 0;
    }
    i2c.stop();
    return n;
}
开发者ID:Quadcopter-safety,项目名称:IMU-mbed-interface,代码行数:18,代码来源:sensor.cpp

示例15: accelerometer_standby

// disable accelerometer to save power
int accelerometer_standby()
{
    char power_ctl;
    int ret = read(accel_w, ACCEL_POWER_CTL, &power_ctl, 1);
    if (ret == 0)
    {
        if (DEBUG)
            pc.printf("Error putting accelerometer in standby (accelerometer_standby)\r\n");
        return 0;
    }
    power_ctl &= 0xF7 ;
    ret = write(accel_w, ACCEL_POWER_CTL, &power_ctl, 1);
    if (ret == 0)
    {
        if (DEBUG)
            pc.printf("Error putting accelerometer in standby (accelerometer_standby)\r\n");
        return 0;
    }
    return 1;
}
开发者ID:Quadcopter-safety,项目名称:IMU-mbed-interface,代码行数:21,代码来源:sensor.cpp


注:本文中的Serial::printf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。