本文整理汇总了C++中SoftwareSerial::print方法的典型用法代码示例。如果您正苦于以下问题:C++ SoftwareSerial::print方法的具体用法?C++ SoftwareSerial::print怎么用?C++ SoftwareSerial::print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoftwareSerial
的用法示例。
在下文中一共展示了SoftwareSerial::print方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: boost_meter
void boost_meter(){
while (digitalRead(buttonApin) == LOW){}
meter_splash("Boost", " Meter");
LCDSerial.print(0xFE, BYTE);
LCDSerial.print(0x01, BYTE);
LCDSerial.print(0xFE, BYTE);
LCDSerial.print(128, BYTE);
LCDSerial.print("Boost Meter");
delay(1000);
LCDSerial.print(0xFE, BYTE);
LCDSerial.print(0x01, BYTE);
long reading = 0;
while (digitalRead(buttonApin) == HIGH){
test_all_meters();
if (digitalRead(buttonBpin) == LOW) {
boost_peak = 0;
}
//non sensor code
//reading = reading + 1;
//real reading code
//0 psi = 12 Vcount;
reading = lookup_boost( long(analogRead(boostPin)) );
boost_peak = max (reading, boost_peak);
generic_bar_display ("psi", 170, reading, boost_peak, 145);
delay(50);
}
return;
}
示例2: setName
/* This function sets the name of an RN-42 module
name should be an up to 20-character value. It MUST BE TERMINATED by a
\r character */
uint8_t makeyMateClass::setName(char * name)
{
if (bluetooth.available())
bluetooth.flush(); // Get rid of any characters in the buffer, we'll need to check it fresh
bluetooth.print("SN,");
for (int i=0; i<20; i++)
{
if (name[i] != '\r')
bluetooth.write(name[i]);
else
break;
}
bluetooth.write('\r');
delay(BLUETOOTH_RESPONSE_DELAY);
bluetoothReceive(rxBuffer);
/* Double check the setting, output results in Serial monitor */
bluetooth.flush();
bluetooth.print("GN");
bluetooth.write('\r');
delay(BLUETOOTH_RESPONSE_DELAY);
Serial.print("Name set to: ");
while (bluetooth.available())
Serial.write(bluetooth.read());
return bluetoothCheckReceive(rxBuffer, "AOK", 3);
}
示例3: onMessage
void onMessage() {
char op = 0;
op = msg.readChar();
// s - set color, f - fade to color
if (op == 's' || op == 'f') {
int red = msg.readInt();
int green = msg.readInt();
int blue = msg.readInt();
if (op == 'f') {
fade_to_color(red, green, blue);
} else if (op == 's') {
set_color(red, green, blue);
}
String color = "colorChange " + String(red) + " " + String(green) + " "
+ String(blue) + "\n";
serial.print(color);
}
// q - query color
else if (op == 'q') {
String color = "currentColor " + String(get_red()) + " " + String(
get_green()) + " " + String(get_blue()) + "\n";
serial.print(color);
} else {
serial.print("Unknown command.");
serial.print(op);
serial.print("\n");
}
}
示例4: sensor_setup
void sensor_setup(){
temp_sensor.begin();//initialize one wire sensor
temp_sensor.setResolution(insideThermometer, 9); //configure sensor parameters
#ifdef DEBUG_SENS
// report on finding the devices on the bus or not
if (!temp_sensor.getAddress(insideThermometer, 0)) softdebug.println("Unable to find address for Device 0");
else{
// report parasite power requirements
softdebug.print("Parasite power is: ");
if (temp_sensor.isParasitePowerMode()) softdebug.println("ON");
else softdebug.println("OFF");
sensors_temperature(); //print temperature for debugging
}
//print voltage sensor value for debugging
softdebug.print("Vin=");
softdebug.println(sensors_vin());
#endif //DEBUG_SENS
}
示例5: loop
//---------------------------------------------------------------------
void loop()
{
// comming from wake-up?
//pinMode(DALLAS_SENSOR_PIN, OUTPUT);
LaCrosse.setTxPinMode(OUTPUT);
power_adc_enable();
delay(500); // ms, needed for settling DS18B20
//--- [0] Betriebsspannung auslesen
lngVcc = getVcc(); // as long
controller_VCC = (lngVcc/1000.0); // as float in Volt, not millivolts (sent as HUM !
//--- [2] read Dallas-Sensor
float theta = ReadSingleOneWireSensor(dallas);
#ifdef USE_SOFT_SERIAL_FOR_DEBUG
//--- debug-output-block
//softSerial.print("Vcc: ");
//softSerial.print( (float) controller_VCC, 1);
//softSerial.print(" Vcc_read: ");
//softSerial.print((long) lngVcc);
//softSerial.print(" ");
softSerial.print("Feuchte: ");
softSerial.print( (float) bodenfeuchte, 1);
softSerial.print(" ");
softSerial.print("Temp: ");
softSerial.println( (float) theta, 1);
#endif
//--- transfer measured values to LaCrosse-instance
LaCrosse.bSensorId = SENSOR_ID;
LaCrosse.t = theta; //--- alias temperature;
LaCrosse.sendTemperature();
LaCrosse.sleep(1); /* 1 second, no power-reduction! */
#ifdef USE_SEPARATE_BATTERIE_ID
LaCrosse.bSensorId = SENSORID_BATTERIE;
#endif
//LaCrosse.h = bodenfeuchte/1000; // controller_VCC;
//LaCrosse.sendHumidity();
//LaCrosse.sleep(1); /* 1 second, no power-reduction! */
//--- preserve more power during sleep phase
pinMode(DALLAS_SENSOR_PIN, INPUT);
LaCrosse.setTxPinMode(INPUT);
//--- switch AD-converter off
power_adc_disable();
//--- fall to deep powersave-sleep, see notes in comments and
Narcoleptic.delay_minutes(DEEP_SLEEP_MINUTES);
//--- deep sleep or test?
//delay(10000); // 10 Sec
}
示例6: printInTens
void printInTens(int Tvar){
if (Tvar < 10){
LCDSerial.print("0");
LCDSerial.print(Tvar);
}
else LCDSerial.print(Tvar);
return;
}
示例7: calcAndDoDelay
int calcAndDoDelay(int i) {
int delayTime = HTTP_DELAY_BETWEEN_RETRY
;
debugSerial2.print(F("Sleeping between retry: "));
debugSerial2.print(delayTime * (i + 1));
printCurTime();
delay(delayTime * (i + 1));
return delayTime;
}
示例8: brightness
void SLCD::brightness(int pct) {
int level = (pct > 100 ? pct % 100 : pct);
float brightness = (((float)level)/100) * 29 + 128;
mySerial.print((char)SPECIAL_CONTROL);
mySerial.print((char)brightness);
// wait for the long string to be sent
delay(5);
}
示例9: Log_UART_SendBuf
void Log_UART_SendBuf(uint8_t *Buf, uint16_t PackLen)
{
uint16_t i;
#if(DEBUG==1)
mySerial.println("MCU :");
for(i = 0; i < PackLen; i++)
{
mySerial.print(" "); mySerial.print(Buf[i],HEX);
}
mySerial.println("");
#endif
}
示例10: connectToWifi
/*ESP8266 Methods*/
void connectToWifi() {
setTeal();
if (wifi.joinAP(SSID, PASSWORD)) {
wifiConnected = true;
debugSerial2.print(F("Join AP success\r\n"));
blinkGreen(3);
setGreen();
} else {
wifiConnected = false;
debugSerial2.print(F("Join AP failure\r\n"));
setRed();
}
}
示例11: Pro_GetFrame
uint8_t Pro_GetFrame()
{
if(rb_can_read(&u_ring_buff) >= 1)
{
if(packageFlag ==0)
{
rb_read(&u_ring_buff, &curValue, 1);
if((lastValue == 0xFF)&&(curValue == 0xFF))
{
tmp_buf[0] = 0xFF;
tmp_buf[1] = 0xFF;
count = 2;
return 1;
}
if((lastValue == 0xFF)&&(curValue == 0x55))
{
lastValue = curValue;
return 1;
}
tmp_buf[count] = curValue;
count ++ ;
lastValue = curValue;
if(count ==4)
{
dataLen = tmp_buf[2]*256+ tmp_buf[3];
}
if(count == (dataLen + 4))
{
memcpy(UART_HandleStruct.Message_Buf, tmp_buf, dataLen + 4);
UART_HandleStruct.Message_Len = dataLen + 4;
#ifdef PROTOCOL_DEBUG
mySerial.print(F("[")); mySerial.print(SystemTimeCount, DEC); mySerial.print(F("]")); mySerial.print(F(" GAgentToMCU:"));
for(uint8_t i = 0; i < dataLen + 4; i++)
{
mySerial.print(" "); mySerial.print(tmp_buf[i], HEX);
}
mySerial.println("");
#endif
memset(tmp_buf, 0, (dataLen + 4));
packageFlag = 1;
lastValue = curValue =0;
return 0;
}
}
}
return 1;
}
示例12: checkAndReleaseConnection
String checkAndReleaseConnection() {
debugSerial2.print(F("Current Status: "));
String status = wifi.getIPStatus();
debugSerial2.println(status);
if (status.indexOf("STATUS:3") != -1) {
if (wifi.releaseTCP()) {
debugSerial2.print(F("release tcp ok\r\n"));
} else {
debugSerial2.print(F("release tcp err\r\n"));
}
} else {
debugSerial2.println(F("no connection to release"));
}
return status;
}
示例13: runLoop
void MqttsClientApplication::runLoop(){
while(true){
int rc = execMsgRequest();
if ((rc != MQTTS_ERR_NO_ERROR || getMsgRequestCount() != 0) &&
getMsgRequestStatus() != MQTTS_MSG_REQUEST){
clearMsgRequest();
#ifdef DEBUG_MQTTS
debug.print(" ErrCode=");
debug.println(rc,DEC);
#endif
}
blinkIndicator(1);
// interrupt Event
if (MQ_intStat == INT0_LL){
MQ_intStat = INT0_WAIT_HL;
interruptHandler();
setInterrupt();
}
// WDT event
if (_sleepMode == MQ_MODE_NOSLEEP){
if (MQ_wdtStat == INT_WDT){
_wdTimer.wakeUp();
_wdTimer.start();
}
}else{
sleepXB();
sleepApp();
wakeupXB();
}
}
}
示例14: loop
void loop() // run over and over
{
int i = 0;
bool found = false;
raw_packet com;
while(usb.available()){
found = true;
if(i < 8){
com.raw[i] = usb.read();
} else{
break;
}
i++;
}
if(!found){
return;
}
packet curpacket = com.nice;
if(curpacket.cmd = 1){
usb.print("hi");
usb.print("\n");
}
}
示例15: sendData
String sendData(String command, const int timeout, boolean debug)
{
String response = "";
esp8266.print(command); // send the read character to the esp8266
long int time = millis();
while( (time+timeout) > millis())
{
while(esp8266.available())
{
// The esp has data so display its output to the serial window
char c = esp8266.read(); // read the next character.
response+=c;
}
}
if(debug)
{
Serial.print(response);
}
return response;
}