Hello,
I have a question on the feather 32u4 and serial
I have connected the Feather 32u4 to the Feather wing RTC
and all is well in that it allows me to send the data to the terminal (serial)
but I am trying to send the data to the due using the due serial 3 but it does not seem to work in that it does not receive any data.
so since it was not working so I thought it would be easier to test the feather with serial in a loop
well that has not gone very well.
I set to software serial coms, one port 5/6 and one 11/12
so i send data out on 5/6 and wait on 11/12
it does not seem to work.
- so does the feather 32u4 support softwareserial
- are there designated pins that need to be used
- is there a version of hardware serial on these boards and is there and example
(I would like to leave the tx/rx (Pins 0/1)serial along for debug purposes)
in the end, i simply wish to send the output of the clock to the due
Here is the output of the code:
2018/5/21 (Monday) 16:19:59
before Sending data on Clock_serial
after Sending data on Clock_serial
2018/5/21 (Monday) 16:20:2
before Sending data on Clock_serial
after Sending data on Clock_serial
2018/5/21 (Monday) 16:20:5
before Sending data on Clock_serial
after Sending data on Clock_serial
2018/5/21 (Monday) 16:20:8
before Sending data on Clock_serial
after Sending data on Clock_serial
and here is the code:
// Date and time functions using a DS3231 RTC connected via I2C and Wire lib
#include <Wire.h>
#include "RTClib.h"
#include <SoftwareSerial.h>
RTC_DS3231 rtc;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
SoftwareSerial Clock_Serial(5, 6); // RX, TX
SoftwareSerial Clock_Serial_test(11, 12); // RX, TX
void setup () {
#ifndef ESP8266
while (!Serial); // for Leonardo/Micro/Zero
#endif
Clock_Serial.begin(9600);
Clock_Serial_test.begin(9600);
Serial.begin(9600);
delay(3000); // wait for console opening
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
if (rtc.lostPower()) {
Serial.println("RTC lost power, lets set the time!");
// following line sets the RTC to the date & time this sketch was compiled
//rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
rtc.adjust(DateTime(2018,5,10,11,53,00));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
}
void loop () {
DateTime now = rtc.now();
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(" (");
Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
Serial.print(") ");
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
Serial.println("");
Serial.println("before Sending data on Clock_serial");
while(Clock_Serial.available() > 0)
{
Serial.println("Sending data on Clock_serial");
Clock_Serial.write("Hello");
while( Clock_Serial.available() > 0)
{
Serial.println("reading: " + Clock_Serial.read());
}
delay(1000);
}
Serial.println("after Sending data on Clock_serial");
// calculate a date which is 7 days and 30 seconds into the future
DateTime future (now + TimeSpan(7,12,30,6));
delay(3000);
}