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


C++ HardwareSerial::print方法代码示例

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


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

示例1: FifoTest

//! Test function to validate that the fifo works as expected.
//! It is always a good idea to validate your data structures. Languages like
//! Python or Perl have such validation built in, while C++ does not. This function
//! can be used in a special build to run through some test cases and make sure
//! that the fifo behaves as we exect, especially in the edge cases, such as when
//! it gets full, wraps around, etc.
void FifoTest(HardwareSerial& ds)
{
    Fifo f1(20);
    Fifo::FifoType x;
    char    buffer[128];
    
    for (x=1;x<25;x++) {
        f1.push(&x);
        sprintf(buffer,"Fifo push %d count %d\n",x,f1.count());
        ds.print(buffer);
    }
    f1.clear();
    sprintf(buffer,"Fifo count %d\n",f1.count());
    ds.print(buffer);
    
    for (x=0;x<10;x++) {
        f1.push(&x);
    }
    sprintf(buffer,"Fifo count %d. Expected 10\n",f1.count());
    ds.print(buffer);
    
    Fifo::FifoType y;
    for (x=1;x<15;x++) {
        f1.pop(&y);
        sprintf(buffer,"Fifo pop %d count %d\n",y,f1.count());
        ds.print(buffer);
    }
}
开发者ID:kutenai,项目名称:MSEE-Firmware,代码行数:34,代码来源:fifo.cpp

示例2: cmdRead

/***
 * Read [pin1] [pin2] ...
 *
 * Read pin values
 * Pins are given in the following way: A0 A1 ... for analog pins
 * 										D0 D1 ... for digital pins
 * Answer is: val1 val2 ...
 */
void cmdRead(int argC, char **argV) {
	char pinType[2];
	int pin;
	int value;

	for (int i = 1; i <= argC; i++) {
		pinType[0] = argV[i][0];
		pinType[1] = NULL;
		pin = strtol(&(argV[i][1]), NULL, 10);

		if (strcasecmp(pinType, "D") == 0) {
			value = digitalRead(pin);
		} else if (strcasecmp(pinType, "A") == 0) {
			value = analogRead(pin);
		} else {
			return;
		}

		// Add read values to answer string
		Serial.print(value);
		if (i < argC) {
			Serial.print(' ');
		}
	}
}
开发者ID:FatihZor,项目名称:instrumentino,代码行数:33,代码来源:controlino.cpp

示例3: setup

void setup()
{
    // Set up serial port for debugging
    Serial.begin(9600);

    while (!Serial)
    {
	; // wait for serial port to connect. Needed for Leonardo only
    }

    // Fullfil the data array
    createDataArray();

    // Read and set the key from the EEPROM
    readKey(KEYLENGTH);

    // Inicialization of the key
    time = micros(); // time start
    aes192_init(key, &key_init);
    emit = micros(); // time start

    Serial.print(F("Inicialisation total takes: "));
    Serial.print(emit - time);
    Serial.println(F(" [us]"));

    // initialize the digital pin as an output.
    // Pin 13 has an LED connected on most Arduino boards:
    pinMode(ledPin, OUTPUT);
}
开发者ID:WayWingsDev,项目名称:LightweightCryptography,代码行数:29,代码来源:main.cpp

示例4: loop

void loop()
{
    sendMsg = "";
    recvMsg = "";
    while (Serial.available()) {
        sendMsg += (char)Serial.read();
        delay(2);
    }

    if(sendMsg.length() > 0)
    {
        mySerial1.println(sendMsg);
        Serial.print("I send: ");
        Serial.println(sendMsg);
    }
    while (mySerial2.available()) {
        recvMsg += (char)mySerial2.read();
        delay(2);
    }
    if(recvMsg.length() > 0)
    {
        Serial.print("I recv: ");
        Serial.println(recvMsg);
    }
    //delay(20);
}
开发者ID:DreamtaleCore,项目名称:AndroidProfiles,代码行数:26,代码来源:arduinozigbee.cpp

示例5: create_gps_file

File create_gps_file() {
	int year;
	unsigned long age;
	byte month, day, hour, minute, second, hundredth;
	gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredth, &age);

	String filename;
	filename.concat(GPS_DIR);
	filename.concat('/');
	filename.concat(year);
	filename.concat('/');
	filename.concat(month);
	filename.concat('/');
	filename.concat(day);
	filename.concat('/');
	filename.concat(hour);
	filename.concat(minute);
	filename.concat(second);
	filename.concat(".GPS");

	char buf[filename.length() + 1];
	filename.toCharArray(buf, sizeof(buf));

	Serial.print("Criando arquivo... ");
	Serial.println(buf);
	return create_file(buf);
}
开发者ID:leandroxk,项目名称:arduino,代码行数:27,代码来源:gps_logger.cpp

示例6: loop2

void loop2()
{

  vw_wait_rx();
  if (vw_get_message(buf, &buflen)) // Non-blocking
  {
    int port=parse();
    switchState(port);
    Serial.print(port);
    Serial.println();
  }
}
开发者ID:paternoy,项目名称:Arduomo,代码行数:12,代码来源:RF4RelayController.cpp

示例7: ajuste_pinos

void Node::ajuste_pinos(){

	if (sizeof(this->comandos) > 0 ){
		if(this->_debug) Serial.println("Ajustando pinagem: ");
		for (int i = 0; i < sizeof(this->comandos)-1; i++){
		   pinMode(this->comandos[i].pino, OUTPUT);
		  if(this->_debug) Serial.print(this->comandos[i].pino+" ");
	    };

	    if(this->_debug) Serial.println("Fim de Ajuste.");
    }
}
开发者ID:b566776,项目名称:JmmRF,代码行数:12,代码来源:Node.cpp

示例8: calcDeltaT

int calcDeltaT(){
  lastLoopUsefulTime = millis()-loopStartTime;
  if(lastLoopUsefulTime<STD_LOOP_TIME) { 
    delay(STD_LOOP_TIME-lastLoopUsefulTime);
    if (debugSerial && debugLoopTime){
      Serial.print("  Esperei: ");
      Serial.println(STD_LOOP_TIME-lastLoopUsefulTime);
    }
  }
  lastLoopTime = millis() - loopStartTime;
  loopStartTime = millis(); 
  return lastLoopTime;
}
开发者ID:ERLudovico,项目名称:Arduino,代码行数:13,代码来源:main.cpp

示例9: debug

void debug(const char* format, ...) {
#ifdef __DEBUG__
    va_list args;
    va_start(args, format);

    char buffer[MAX_LOG_LINE_LENGTH];
    vsnprintf(buffer, MAX_LOG_LINE_LENGTH, format, args);

    Serial2.print(buffer);

    va_end(args);
#endif // __DEBUG__
}
开发者ID:DuinoPilot,项目名称:cantranslator,代码行数:13,代码来源:log.cpp

示例10: loop

void loop()
{
    if (Dennao.available() > 0) {
        read_buf_len = Dennao.recv(read_buf, DENNAO_RX_SIZE, 0);
        for(int i=0;i<read_buf_len;i++){
            Uart.print((char)read_buf[i]);
        }
    }
    if (Uart.available() > 0) {
        uint8_t incomingByte = Uart.read();
        if(incomingByte=='\r'){
            Dennao.send(out_buf, out_buf_len, 0);
        }else{
            out_buf[out_buf_len++] = incomingByte;
        }
    }
}
开发者ID:jimmyken793,项目名称:dennao-gadget-sdk,代码行数:17,代码来源:main.cpp

示例11: loop

void loop(){
	// update incoming values
	g_ServoIn.update();
	Serial.print(g_values[0]);
        Serial.print(" - ");
	Serial.print(g_values[1]);
	Serial.print(" - ");
        Serial.print(g_values[2]);
        Serial.print(" - ");	
        Serial.println(g_values[3]);
	
// handle servo values here, stored in g_values
}
开发者ID:ERLudovico,项目名称:Arduino,代码行数:13,代码来源:main.cpp

示例12: process_serial

void Comm::process_serial()
{
    if (! Serial.available()) {
        return;
    }

    byte addr = serial_get();
    byte pkt = serial_get();
    byte num = serial_get();

    bool okay = false;
    if (!addr) {                // handle by master
        if (m_handler) {
            okay = m_handler(num);
            serial_drain();
        }
        else {
            okay = drain(num);
        }
    }
    else {                      // send to slave
        okay = transmit(addr,num);
        serial_drain();
    }

    if (okay) {
        Serial.print("OK");
    }
    else {
        Serial.print("NO");
    }
    Serial.print(pkt);
    Serial.print(addr);
    Serial.print(num);
    Serial.print('\0');
}
开发者ID:brettviren,项目名称:chainbowduino,代码行数:36,代码来源:comm.cpp

示例13: atualizaSensors

void atualizaSensors(int deltaT){

  accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);

  /* Calcula os angulos (em graus) de X e Y  */
  accYangle = (atan2(ax,az)+PI)*RAD_TO_DEG;
  accXangle = (atan2(ay,az)+PI)*RAD_TO_DEG; 
  
  double gyroXrate =  (double)gx/131.0;
  double gyroYrate = -((double)gy/131.0);
  
  /* Calcula os angulos X e Y do Giroscopio*/  
  gyroXangle += gyroXrate*((double)deltaT/1000);  
  gyroYangle += gyroYrate*((double)deltaT/1000);
  
  /* Aplica o Filtro Complementar*/
  compAngleX = (0.93*(compAngleX+(gyroXrate*(double)deltaT/1000)))+(0.07*accXangle); 
  compAngleY = (0.93*(compAngleY+(gyroYrate*(double)deltaT/1000)))+(0.07*accYangle);  

  // DEBUG //
  if (debugSerial && debugMPU6050){
    Serial.print(accXangle);
    Serial.print("\t");
    Serial.print(accYangle);
    Serial.print("\t"); 

    Serial.print(gyroXangle);
    Serial.print("\t");
    Serial.print(gyroYangle);
    Serial.print("\t");

    Serial.print(compAngleX);
    Serial.print("\t");
    Serial.print(compAngleY); 
    Serial.print("\t");
  }
  delay(1);
}
开发者ID:ERLudovico,项目名称:Arduino,代码行数:38,代码来源:main.cpp

示例14: debug

void Radio::debug(HardwareSerial& serial) {
  serial.print((int)m_pressedButton);
  serial.print("\t");
  serial.print((int)m_bytesToSent);
}
开发者ID:KastB,项目名称:boat_autopilot,代码行数:5,代码来源:Radio.cpp

示例15: debugHeader

void Radio::debugHeader(HardwareSerial& serial) {
  serial.print(F("m_pressedButtonDebug\tm_bytesToSent"));
}
开发者ID:KastB,项目名称:boat_autopilot,代码行数:3,代码来源:Radio.cpp


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