void setup() { RFID.begin(9600); // start serial to RFID reader Serial.begin(9600); // start serial to PC //lcd.print("hello, world!"); Serial.println("Ready!"); }
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 }
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"); }
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(""); } }
int main(int argc, char** argv){ #if defined(ARDUINO) && (defined(DEBUG_NW) || defined(DEBUG_MQTTSN) || defined(DEBUG)) debug.begin(9600); #endif setup(); loop(); }
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); }
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!!"); }
//******************************************************* // 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..."); }
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(); }
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(); }
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(); }
// 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; }
// ************************************************************************** // * 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 }
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; }
/* 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 ); }
void setup(){ Serial.begin(9600); Serial.println("Serial Ready"); RFID.begin(9600); Serial.println("RFID Ready"); pinMode(rxPin, INPUT); pinMode(txPin, OUTPUT); lcd.begin(16, 2); }
////////////////////////////////////////////////////////////////////////// // setup ////////////////////////////////////////////////////////////////////////// void setup() { // pin modes pinMode(6, INPUT); pinMode(13, OUTPUT); pinMode(7, OUTPUT); // other setup _gps.begin(9600); Serial.begin(9600); }
void setup(){ // configure interrupt pin or RX as input pinMode(pin, INPUT); // initialize serial port XBee.begin(9600); // add interrupt with pin, ISR, and mode attachInterrupt(digitalPinToInterrupt(pin), XBee_receive, RISING); }
void phone::init() { #if PHONESOFTSERIAL mySerial.begin(19200); // the Serial1 baud rate #else Serial.begin(19200); #endif Serial.println("ATH"); }
void SDS011::begin(uint8_t pin_rx, uint8_t pin_tx) { _pin_rx = pin_rx; _pin_tx = pin_tx; SoftwareSerial *softSerial = new SoftwareSerial(_pin_rx, _pin_tx); softSerial->begin(9600); sds_data = softSerial; }
void lcd_begin(){ //lcd = SoftwareSerial(0,2); lcd.begin(9600); // set the size of the display if it isn't 16x2 (you only have to do this once) lcd.write(0xFE); lcd.write(0xD1); lcd.write(16); // 16 columns lcd.write(2); // 2 rows delay(10); }
int ncArduinoInitialize( ncFuntionChipReadyToTransmit_t ncFuntionChipReadyToTransmit) { attachInterrupt(0, ncFuntionChipReadyToTransmit, FALLING); attachInterrupt(1, ncArduinoSerialEvent, FALLING); mySerial.begin(57600); //debug �window Serial.begin(115200); return 0; }
void setup() { pinMode(txPin, OUTPUT); mySerial.begin(9600); Serial.begin(9600); Wire.begin(); i = 0; }
void setupBlueToothConnection() { blueToothSerial.begin(38400); blueToothSerial.print("\r\n+STWMOD=1\r\n"); blueToothSerial.print("\r\n+STNA=SeeedBTMaster\r\n"); blueToothSerial.print("\r\n+STAUTO=0\r\n"); delay(2000); blueToothSerial.flush(); blueToothSerial.print("\r\n+INQ=1\r\n"); Serial.println("inquiring"); delay(2000); char recvChar; /* while(1){ //this part is for auto detecting and connecting to a slave but something is wrong with the parsing of the address, use this to print out the address and then put it in manulely below if(blueToothSerial.available()){ recvChar = blueToothSerial.read(); recvBuf += recvChar; nameIndex = recvBuf.indexOf(slaveName); if ( nameIndex != -1 ){ addrIndex = (recvBuf.indexOf(retSymb,(nameIndex - retSymb.length()- 18) ) + retSymb.length()); slaveAddr = recvBuf.substring(addrIndex, nameIndex); break; } } }*/ connectCmd += slaveAddr; connectCmd += "\r\n"; int connectOK = 0; Serial.print("Connecting to slave:"); Serial.print(slaveAddr); Serial.println(slaveName); do{ blueToothSerial.print("/*put slave address here*/"); recvBuf = ""; while(1){ if(blueToothSerial.available()){ recvChar = blueToothSerial.read(); recvBuf += recvChar; if(recvBuf.indexOf("CONNECT:OK") != -1){ connectOK = 1; Serial.println("Connected!"); blueToothSerial.print("Connected!"); break; }else if(recvBuf.indexOf("CONNECT:FAIL") != -1){ Serial.println("Connect again!"); break; } } } }while(0 == connectOK); }
void SLCD::init() { mySerial.begin(9600); clear(); print("SerLCD Class", 0, 2); brightness(100); underlineCursorOff(); print("initialized", 1, 3); flash(3, 100) ; }
void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } Serial.println("KD0PBZ - CV-I"); // set the data rate for the SoftwareSerial port mySerial.begin(9600); }
// This means that you need to connect the TX line from the esp to the Arduino's pin 2 // and the RX line from the esp to the Arduino's pin 3 void setup() { Serial.begin(9600); esp8266.begin(9600); // your esp's baud rate might be different sendData("AT+RST\r\n",2000,DEBUG); // reset module sendData("AT+CWMODE=2\r\n",1000,DEBUG); // configure as access point sendData("AT+CIFSR\r\n",1000,DEBUG); // get ip address sendData("AT+CIPMUX=1\r\n",1000,DEBUG); // configure for multiple connections sendData("AT+CIPSERVER=1,80\r\n",1000,DEBUG); // turn on server on port 80 }
void GizWits_init(uint8_t P0_Len) { Pro_HeadPartP0CmdTypeDef *Pro_D2W_ReportStatusStruct = (Pro_HeadPartP0CmdTypeDef *)g_DevStatus; #ifdef M5_VERSION Serial1.begin(9600); #else Serial.begin(9600); #endif #if(GetFrame==1) //自定义引脚通信SoftwareSerial初始 mySerial.begin(9600); #endif //定时中断初始 MsTimer2::set(1, gokit_timer); // 1ms period MsTimer2::start(); if(P0_Len > MAX_P0_LEN) { mySerial.println("Warning P0_Len out of range"); while(1); } //RingBuffer rb_new(&u_ring_buff); memset((uint8_t *)&g_DevStatus, 0, 128); memset(&Pro_M2W_ReturnInfoStruct, 0, sizeof(Pro_M2W_ReturnInfoStruct)); Pro_M2W_ReturnInfoStruct.Pro_HeadPart.Head[0] = 0xFF; Pro_M2W_ReturnInfoStruct.Pro_HeadPart.Head[1] = 0xFF; Pro_M2W_ReturnInfoStruct.Pro_HeadPart.Len = exchangeBytes(sizeof(Pro_M2W_ReturnInfoStruct) - 4); Pro_M2W_ReturnInfoStruct.Pro_HeadPart.Cmd = Pro_D2W__GetDeviceInfo_Ack_Cmd; memcpy(Pro_M2W_ReturnInfoStruct.Pro_ver, PRO_VER, strlen(PRO_VER)); memcpy(Pro_M2W_ReturnInfoStruct.P0_ver, P0_VER, strlen(P0_VER)); memcpy(Pro_M2W_ReturnInfoStruct.Hard_ver, HARD_VER, strlen(HARD_VER)); memcpy(Pro_M2W_ReturnInfoStruct.Soft_ver, SOFT_VER, strlen(SOFT_VER)); memcpy(Pro_M2W_ReturnInfoStruct.Product_Key, PRODUCT_KEY, strlen(PRODUCT_KEY)); Pro_M2W_ReturnInfoStruct.Binable_Time = exchangeBytes(0); g_P0DataLen = P0_Len; Pro_D2W_ReportStatusStruct->Pro_HeadPart.Head[0] = 0xFF; Pro_D2W_ReportStatusStruct->Pro_HeadPart.Head[1] = 0xFF; Pro_D2W_ReportStatusStruct->Pro_HeadPart.Len = exchangeBytes(sizeof(Pro_HeadPartP0CmdTypeDef) - 4); Pro_D2W_ReportStatusStruct->Pro_HeadPart.Cmd = 0x0; Pro_D2W_ReportStatusStruct->Pro_HeadPart.SN = 0; Pro_D2W_ReportStatusStruct->Pro_HeadPart.Flags[0] = 0x0; Pro_D2W_ReportStatusStruct->Pro_HeadPart.Flags[1] = 0x0; //Pro_D2W_ReportStatusStruct->Action = 0x0; }
void setup() { //--- preset SensorId & TX instance LaCrosse.bSensorId = SENSOR_ID; pinMode(TX_433_PIN, OUTPUT); digitalWrite(TX_433_PIN, LOW); //--- init Softwareserial, only 1 pin is used, Trick (!): rx defined as pin 99! //--- needs more flash memory! #ifdef USE_SOFT_SERIAL_FOR_DEBUG softSerial.begin(38400); #endif delay(1000); }
void setup() { char buf[64]; Serial.begin(115200); Serial.println("Starting"); Serial.print("Free memory: "); Serial.println(wifly.getFreeMemory(),DEC); wifiSerial.begin(9600); if (!wifly.begin(&wifiSerial, &Serial)) { Serial.println("Failed to start wifly"); } if (!wifly.isAssociated()) { Serial.println("Joining network"); wifly.setSSID(mySSID); wifly.setPassphrase(myPassword); wifly.enableDHCP(); if (wifly.join()) { Serial.println("Joined wifi network"); } else { Serial.println("Failed to join wifi network"); } } else { Serial.println("Already joined network"); } Serial.println("WiFly ready"); Serial.print("MAC: "); Serial.println(wifly.getMAC(buf, sizeof(buf))); Serial.print("IP: "); Serial.println(wifly.getIP(buf, sizeof(buf))); Serial.print("Netmask: "); Serial.println(wifly.getNetmask(buf, sizeof(buf))); Serial.print("Gateway: "); Serial.println(wifly.getGateway(buf, sizeof(buf))); Serial.println("Set DeviceID"); wifly.setDeviceID("Wifly-TCP"); Serial.print("DeviceID: "); Serial.println(wifly.getDeviceID(buf, sizeof(buf))); wifly.setIpProtocol(WIFLY_PROTOCOL_TCP); if (wifly.isConnected()) { Serial.println("Old connection active. Closing"); wifly.close(); } }