I'm trying to use SoftwareSerial on Udoo Neo but it says: sketch_apr10a.ino:1:28: fatal error: SoftwareSerial.h: No such file or directory compilation terminated. Error compiling. Also, when I try using Serial1, it gives me: sketch_apr10a.ino: In function 'void setup()': sketch_apr10a:5: error: 'Serial1' was not declared in this scope 'Serial1' was not declared in this scope What am I doing wrong ?
Hi there, I'm sorry, but SoftwareSerial is not supported by UDOO Neo. BTW, what do you need that for? If you need access to another serial (hw pins 0-1), just use Serial0 instance instead. Hope this helps, Ek5
Well, I want to use that code to configure a BT Module: /*-----( Import needed libraries )-----*/ #include <SoftwareSerial.h> /*-----( Declare Constants and Pin Numbers )-----*/ #define HC_05_TXD_ARDUINO_RXD 2 #define HC_05_RXD_ARDUINO_TXD 3 #define HC_05_SETUPKEY 4 #define HC_05_PWR1 5 // Connect in parallel to HC-05 VCC #define HC_05_PWR2 6 // Connect in parallel to HC-05 VCC /*-----( Declare objects )-----*/ SoftwareSerial BTSerial(HC_05_TXD_ARDUINO_RXD, HC_05_RXD_ARDUINO_TXD); // RX | TX /*-----( Declare Variables )-----*/ //NONE void setup() /****** SETUP: RUNS ONCE ******/ { pinMode(HC_05_SETUPKEY, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode pinMode(HC_05_PWR1, OUTPUT); // Connect in parallel to HC-05 VCC pinMode(HC_05_PWR2, OUTPUT); // Connect in parallel to HC-05 VCC digitalWrite(HC_05_SETUPKEY, HIGH); // Set command mode when powering up Serial.begin(9600); // For the Arduino IDE Serial Monitor Serial.println("YourDuino.com HC-05 Bluetooth Module AT Command Utility V1.02"); Serial.println("Set Serial Monitor to 'Both NL & CR' and '9600 Baud' at bottom right"); Serial.println("Vcc Power Up DELAY"); delay(2000); Serial.println("Applying VCC Power. LED should blink SLOWLY: 2 Seconds ON/OFF"); digitalWrite(HC_05_PWR1, HIGH); // Power VCC digitalWrite(HC_05_PWR2, HIGH); delay(2000); Serial.println("Enter AT commands in top window."); BTSerial.begin(38400); // HC-05 default speed in AT command mode }//--(end setup )--- void loop() /****** LOOP: RUNS CONSTANTLY ******/ { // READ from HC-05 and WRITE to Arduino Serial Monitor if (BTSerial.available()) Serial.write(BTSerial.read()); // READ Arduino Serial Monitor and WRITE to HC-05 if (Serial.available()) BTSerial.write(Serial.read()); }//--(end main loop )--- /*-----( Declare User-written Functions )-----*/ //NONE //*********( THE END )***********
If you connect the serial pins of your Bluethooth module to pin 0 and 1 instead of 2 and 3 you can use the hardware serial Serial0 instead of SoftwareSerial (btserial). I think you cannot plug it in directly then but have to rewire a little bit.