本文整理汇总了C++中SoftwareSerial::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ SoftwareSerial::begin方法的具体用法?C++ SoftwareSerial::begin怎么用?C++ SoftwareSerial::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoftwareSerial
的用法示例。
在下文中一共展示了SoftwareSerial::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void setup()
{
RFID.begin(9600); // start serial to RFID reader
Serial.begin(9600); // start serial to PC
//lcd.print("hello, world!");
Serial.println("Ready!");
}
示例2: setup
void setup()
{
/* button click interrupt */
attachInterrupt(1, buttonClicked, FALLING);
/* start hw & sw serial */
Serial.begin(WILLIAM_BAUDRATE); // output
mySerial.begin(MIDI_BAUDRATE); // input
/* set up song and songbank callbacks */
setupSongHandling();
/* set initial outgoing packet (to William) */
setOutgoingPacket(WHITE);
/* setup status leds for debugging */
DDRB |= (1<<0)|(1<<2)|(1<<3)|(1<<4)|(1<<5);
DDRD |= (1<<5)|(1<<6);
/* start 38KHz carrier wave for infrared TX */
init_ir_modulator();
#ifdef _DEBUG
for (int i=0; i < COLOUR_TRIPLET_N; i++){
char * p_triplet = colourTriplets[i];
for (int j=0; j < 3; j++)
Serial.write(p_triplet[j]);
Serial.write(9);
}
Serial.write(songBank.n);
for (unsigned int i=0; i < songBank.n; i++) {
Serial.write(songBank.pp_songs[i]->n);
for (int j=0; j < songBank.pp_songs[i]->n; j ++) {
Serial.write(songBank.pp_songs[i]->p_events[j].note);
}
}
#endif
}
示例3: join
void S4::begin(char* DeviceName, char* RouterName)
{
deviceName = DeviceName;
WDTCSR |= (1 << WDCE) | (1 << WDE);
WDTCSR = 0;
microSerial.begin(buadRate); // this had to be before the gps
Wire.begin();
S4GPS.begin(buadRate);
if(WiFiIsOn)
{
WiFly.begin(); // start the WiFly process
join(RouterName); // connect to the router
WiFiHankshake(DeviceName); // connect to the server
}
sensorData = "<sensor>";
sensorData += deviceName;
sensorData += ",";
Serial.println("Starting");
}
示例4: setup
void setup()
{
RFID.begin(9600); // start serial to RFID reader
Serial.begin(9600); // start serial to PC
lcd.begin(16, 2);
//lcd output
lcd.clear();
lcd.print("There are "); //start printing the result
lcd.print(space_left); //then how many spaces
lcd.print(" spaces left."); //words
lcd.println(" "); //spaces
for (int i = 0; i < 5; i++)
{
id_marker[i] = 0;
}
Serial.println("Ready!");
//sets everything in the array equal to blank
for(int i=0; i<5; i++)
{
id_array[i] = String("");
}
}
示例5: main
int main(int argc, char** argv){
#if defined(ARDUINO) && (defined(DEBUG_NW) || defined(DEBUG_MQTTSN) || defined(DEBUG))
debug.begin(9600);
#endif
setup();
loop();
}
示例6: setup
void setup()
{
response.reserve(RESPONSE_BUFFER);
url.reserve(STRING_BUFFER);
cmd.reserve(COMMAND_BUFFER);
Serial.begin(9600);
Serial.println("PowerInterlock Start");
turnOff();
disableTiming();
RFID.begin(2400);
delay(500);
pinMode(RFID_ENABLE, OUTPUT);
//digitalWrite(RFID_ENABLE, LOW);
pinMode(DEVICE_PIN, OUTPUT);
Ethernet.begin(mac, ip, dns1);
//After a couple hours, the DHCP started to fail for some reason
/*if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
Ethernet.begin(mac, ip);
}*/
// give the Ethernet shield a second to initialize:
delay(1000);
}
示例7: begin
void ICACHE_FLASH_ATTR GlobalsClass::begin()
{
//serveron("/probesave", handleProbeSave);
//MyWebServer.ServerON("/test", &TestCallback);
//MyWebServer.CurServer->on("/test", TestCallback);
server.on("/flashavr", FlashHM);
server.on("/hm/curinfo", sendHMJsonweb);
server.on("/hm/set", setHMweb);
server.on("/testgz", testgz);
MyWebServer.jsonSaveHandle = &JsonSaveCallback; //server on jsonsave file we hook into it to see which one and process....
#ifdef SoftSerial
#include <SoftwareSerial.h>
qCon.begin(HM_COM_BAUDRATE);
delay(20);
// qCon.enableRx(true);
delay(20);
#endif
#ifdef HardSerial
#ifdef HardSerialSwap
Serial.swap(); //toggle between use of GPIO13/GPIO15 or GPIO3/GPIO(1/2) as RX and TX
#endif
#endif
if (WiFi.status() == WL_CONNECTED)
{
// ... print IP Address to HM
qCon.println("/set?tt=WiFi Connected,"+ (String)WiFi.localIP()[0] + "." + (String)WiFi.localIP()[1] + "." + (String)WiFi.localIP()[2] + "." + (String)WiFi.localIP()[3]);
} else qCon.println("/set?tt=WiFi NOT, Connected!!");
}
示例8: setup
//*******************************************************
// SETUP
//*******************************************************
void setup(){
Serial.begin(9600);
Serial.println("Starting Slave...");
delay(2000);
//Fast-SPI initialisieren
FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
//Zuerst PWM-Treiber disable
Serial.println("Set PWM off");
pinMode(Enable,OUTPUT);
digitalWrite(Enable,LOW);
DisplayRGB(0,0,0);//LED-Streifen auf Schwarz
delay(1000);
Serial.println("Set SPI off");
//Alle Fast-SPI-Lampen aus
for (int a=0;a<NUM_LEDS;a++){
leds[a]=CRGB::Black;
}
Serial.println("Init RS485");
//RS485 Initialisieren
rs485.begin (9600);
pinMode (ENABLE_PIN, OUTPUT); // driver output enable
Serial.println("Start loop...");
}
示例9: UploadResults
void UploadResults() {
leds[0] = CRGB::Yellow;
FastLED.show();
uint16_t returncode;
TurnOnFona();
delay(1000);
myfona.begin(4800);
fona.begin(myfona);
delay(3500);
GetConnected();
delay(3000);
fona.enableGPRS(true);
delay(3000);
char url[200];
uint16_t statuscode;
int16_t length;
sprintf(url, "%s%s%s%s", "http://api.ubirch.com/rp15/push?id=", userid, "&erg=", results);
flushSerial();
if (!fona.HTTP_GET_start(url, &statuscode, (uint16_t *) &length)) {
Serial.println(F("Get Failed!"));
}
fona.HTTP_GET_end();
delay(100);
GetDisconnected();
delay(1000);
TurnOffFona();
leds[0] = CRGB::Black;
FastLED.show();
}
示例10: setup
void setup()
{
gprsSerial.begin(9600);
Serial.begin(9600);
Serial.println("Config SIM900...");
delay(2000);
Serial.println("Done!...");
gprsSerial.flush();
Serial.flush();
// attach or detach from GPRS service
gprsSerial.println("AT+CGATT?");
delay(100);
toSerial();
// bearer settings
gprsSerial.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");
delay(2000);
toSerial();
// bearer settings
gprsSerial.println("AT+SAPBR=3,1,\"APN\",\"airtelgprs.com\"");
delay(2000);
toSerial();
// bearer settings
gprsSerial.println("AT+SAPBR=1,1");
delay(2000);
toSerial();
}
示例11: setup
void setup() {
// Init display
mySerial.begin(9600); // set up serial port for 9600 baud
delay(500); // wait for display to boot up
// Setup DS1820 temp sensor
sensors.begin();
sensors.setResolution(Sensor1, 11);
sensors.setResolution(Sensor2, 11);
sensors.setWaitForConversion(false);
sensors.requestTemperatures();
delayInMillis = 750 / (1 << (12 - 11)); //750 for 12bit, 400 for 11bit, 220 for 10bit, 100 for 9bit
// calc by delayInMillis = 750 / (1 << (12 - resolution));
lastTempRequest = millis();
// Set next state i FSM
menu_FSM = M_PAGE1;
menu_last_state = M_PAGE1;
system_FSM = S_IDLE;
// **************** Set up display *******************
DisplayClear();
MenuShowTime = millis();
// **************** Set up RTC ***********************
Wire.begin();
rtc.begin();
//TimeDate(rtc.now(),dateTimeString,1);
//DateTime now = rtc.now();
// write on display
DisplayGoto(2,0);
mySerial.print("Version 0.9B");
// **************** Set up SD card *******************
pinMode(10, OUTPUT);
DisplayGoto(1,0);
mySerial.write("Init SD -> "); // clear display + legends
DisplayGoto(1,11);
// see if the card is present and can be initialized:
if (!SD.begin())
mySerial.write("Fail");
else
mySerial.write("OK");
delay(2000);
// ***************** Clear display ********************
DisplayClear();
}
示例12: begin
// Herkulex begin with Arduino Uno
void HerkulexClass::begin(long baud, int rx, int tx)
{
SwSerial.setRX(rx);
SwSerial.setTX(tx);
SwSerial.begin(baud);
port = SSerial;
}
示例13: setup
// **************************************************************************
// * Power Up Initial
// **************************************************************************
void setup()
{
mySerial.begin(4800);
Serial.begin(10420);
delay(500);
line_following.line_following_setup(); //initialize the status of line following robot
line_following.all_stop(); //all motors stop
}
示例14: SoftwareSerial
PZEM004T::PZEM004T(uint8_t receivePin, uint8_t transmitPin)
{
SoftwareSerial *port = new SoftwareSerial(receivePin, transmitPin);
port->begin(PZEM_BAUD_RATE);
this->serial = port;
this->_readTimeOut = PZEM_DEFAULT_READ_TIMEOUT;
this->_isSoft = true;
}
示例15: setup
/* Arduino-required function */
void setup()
{
Serial.begin(9600);
mySerial.begin(MIDI_BAUDRATE);
/* Set callbacks for songs */
data_short.setCallbacks( complete_data_short, NULL );
epona.setCallbacks( complete_epona, NULL );
fifties_short.setCallbacks( complete_fifties_short, NULL );
}