editor1979
Banned
I've been running a program on a Teensy 3.6 for a few months without issue that sends RTC Date/Time, Temperature/Humidity, and events like Birthdays/Holidays to a Dot Matrix LED Display that sits on my desk. The display was an advertisement board scavenged form the top of an old Public Internet Access Terminal.
Today, I loaded an older program to review it's function about sending temperature/humidity in a string to the display. The program loaded without issue then I tried to reload the original program and now I'm getting a "Error compiling for board Teensy 3.6." message.
I'm running:
Macbook Pro 10.13.6
Arduino 1.8.2
Teensy Loader 1.36
Processing 2.2.1 (For setting the time)
At this point, I just want to put the original program back on the Teensy.
Display manual
https://drive.google.com/open?id=0BzJvWIL7mrfcS0NOOVhtY3Njb1k
Arduino Code:
Processing Time Set:
I don't have any issues with setting the time once the program is loaded. Every once in a while, I update the time to account for drift in the Teensy's RTC.
The display is connected to the processor using a single channel HEX-FET (IRFD110) and an RS-232 interface (SP-233). I also get temperature and humidity from a Texas Instruments HDC 1080 on the I2C Bus. Battery backup is provided by a KEMET FE0H155ZF Supercapacitor instead of a battery. I can make a connection diagram if necessary.
If someone can help me figure out why this suddenly compile, I would appreciate it.
Nothing has changed since the last time this sketch was compiled, same sketch with no changes, same processor, same computer, new house, which is why I'm perplexed and seeking help.
Today, I loaded an older program to review it's function about sending temperature/humidity in a string to the display. The program loaded without issue then I tried to reload the original program and now I'm getting a "Error compiling for board Teensy 3.6." message.
I'm running:
Macbook Pro 10.13.6
Arduino 1.8.2
Teensy Loader 1.36
Processing 2.2.1 (For setting the time)
At this point, I just want to put the original program back on the Teensy.
Display manual
https://drive.google.com/open?id=0BzJvWIL7mrfcS0NOOVhtY3Njb1k
Arduino Code:
Code:
#include <font5x7.h>
#include <font8x16.h>
#include <fontlargenumber.h>
#include <sevenSegment.h>
#include <TimeLib.h>
#include <Wire.h>
#include "ClosedCube_HDC1080.h"
ClosedCube_HDC1080 hdc1080;
const int SW1 = 16;
const int led = 13;
int SWS = 0;
int T = 0;
int H = 0;
int easterMonth = 0;
int easterDay = 0;
int LarryBD = 0;
int StephenBD = 0;
int MLeMayBD = 0;
int MichelleLeMayBD = 0;
int KWicksBD = 0;
int ADavisBD = 0;
int DMeagerBD = 0;
void setup() {
setSyncProvider(getTeensy3Time); /* If you get an error saying this line
was not declared in this scope,
you missed a bracket somewhere.*/
delay(100);
if (timeStatus()!= timeSet) {
Serial.println("Unable to sync with the RTC");
} else {
Serial.println("RTC has set the system time");
}
hdc1080.begin(0x40);
pinMode(SW1, INPUT);
pinMode(led, OUTPUT);
// Serial
Serial1.begin(4800);
delay(100);
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of nulls
Serial1.write(0x01);
Serial1.write("Z00");
Serial1.write(0x02);
Serial1.write("E$"); //Clear memory and set memory configuration
Serial1.write("AAU0100FF00");
//Serial1.write("BBL007F0000");
//Serial1.write("CAU0100FF00");
//Serial1.write("DAU0100FF00");
//Serial1.write("EAU0100FF00");
Serial1.write(0x04);
//Text file "A" Tempature & Humidity read from an HDC1080 on the I2C bus
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //Sign address (00 = All addresses)
Serial1.write(0x02); //Start of Text
Serial1.write("A"); //Write String File
Serial1.write(0x1b); //ESC
Serial1.write(0x22); //Top line
Serial1.write(0x62); //Stationary text Centered
Serial1.write(0x10); //
Serial1.write("B"); //Settings for string file B
Serial1.write(0x04); //End of Transmission
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("Loading...");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print("Please wait...");
Serial1.write(0x04); //End Transmission
//delay (5000);
}
} //End setup
void loop() {
//Timekeeping
if (Serial.available()) {
time_t t = processSyncMessage();
if (t != 0) {
Teensy3Clock.set(t); // set the RTC
setTime(t);
}
}
digitalClockDisplay();
delay(900);
int SWS = digitalRead(SW1);
if (SWS == 1)
{
DNE();
}
{
// Connect to API
//Send Tempature & Humidity to serial monitor
T = hdc1080.readTemperature();
Serial.print(hdc1080.readTemperature()*1.8+32);
Serial.print("F");
Serial.print('\n');
Serial.print(hdc1080.readHumidity());
Serial.print("%");
Serial.print('\n');
Serial.print('\n');
//Write File "A" containing Text with I2C data from HDC1080 device
if (second() == 0)
{
Temperature();
}
SWS = digitalRead(SW1);
if (SWS == 1)
{
DNE();
}
if (second() == 10)
{
time();
}
SWS = digitalRead(SW1);
if (SWS == 1)
{
DNE();
}
// Birthdays
if (month() == 3 && day() == 20 && second() == 50)
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("Happy ");
DMeagerBD = year() - 1994;
Serial1.print(DMeagerBD);
if (DMeagerBD == 11){
Serial.print("th ");
}
else if (DMeagerBD == 1 || DMeagerBD == 21 || DMeagerBD == 31 || DMeagerBD == 41 || DMeagerBD == 51 || DMeagerBD == 61 || DMeagerBD == 71 || DMeagerBD == 81 || DMeagerBD == 91 || DMeagerBD == 101){
Serial1.print("st ");
}
else if (DMeagerBD == 2 || DMeagerBD == 22 || DMeagerBD == 32 || DMeagerBD == 42 || DMeagerBD == 52 || DMeagerBD == 62 || DMeagerBD == 72 || DMeagerBD == 82 || DMeagerBD == 92 || DMeagerBD == 102){
Serial1.print("nd ");
}
else if (DMeagerBD == 3 || DMeagerBD == 23 || DMeagerBD == 33 || DMeagerBD == 43 || DMeagerBD == 53 || DMeagerBD == 63 || DMeagerBD == 73 || DMeagerBD == 83 || DMeagerBD == 93 || DMeagerBD == 103){
Serial1.print("rd ");
}
else
{
Serial1.print("th ");
}
Serial1.print("Birthday");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print("Drew Meager");
Serial1.print("!!!");
Serial1.write(0x04); //End Transmission
//delay (5000);
}
if (month() == 6 && day() == 7 && second() == 50)
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("Happy ");
StephenBD = year() - 1979;
Serial1.print(StephenBD);
if (StephenBD == 11){
Serial.print("th ");
}
else if (StephenBD == 1 || StephenBD == 21 || StephenBD == 31 || StephenBD == 41 || StephenBD == 51 || StephenBD == 61 || StephenBD == 71 || StephenBD == 81 || StephenBD == 91 || StephenBD == 101){
Serial1.print("st ");
}
else if (StephenBD == 2 || StephenBD == 22 || StephenBD == 32 || StephenBD == 42 || StephenBD == 52 || StephenBD == 62 || StephenBD == 72 || StephenBD == 82 || StephenBD == 92 || StephenBD == 102){
Serial1.print("nd ");
}
else if (StephenBD == 3 || StephenBD == 23 || StephenBD == 33 || StephenBD == 43 || StephenBD == 53 || StephenBD == 63 || StephenBD == 73 || StephenBD == 83 || StephenBD == 93 || StephenBD == 103){
Serial1.print("rd ");
}
else
{
Serial1.print("th ");
}
Serial1.print("Birthday");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print("Stephen");
Serial1.print("!!!");
Serial1.write(0x04); //End Transmission
//delay (5000);
}
if (month() == 12 && day() == 16 && second() == 50)
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("Happy ");
LarryBD = year() - 1983;
Serial1.print(LarryBD);
if (LarryBD == 11){
Serial.print("th ");
}
else if (LarryBD == 1 || LarryBD == 21 || LarryBD == 31 || LarryBD == 41 || LarryBD == 51 || LarryBD == 61 || LarryBD == 71 || LarryBD == 81 || LarryBD == 91 || LarryBD == 101){
Serial1.print("st ");
}
else if (LarryBD == 2 || LarryBD == 22 || LarryBD == 32 || LarryBD == 42 || LarryBD == 52 || LarryBD == 62 || LarryBD == 72 || LarryBD == 82 || LarryBD == 92 || LarryBD == 102){
Serial1.print("nd ");
}
else if (LarryBD == 3 || LarryBD == 23 || LarryBD == 33 || LarryBD == 43 || LarryBD == 53 || LarryBD == 63 || LarryBD == 73 || LarryBD == 83 || LarryBD == 93 || LarryBD == 103){
Serial1.print("rd ");
}
else
{
Serial1.print("th ");
}
Serial1.print("Birthday");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print("Larry Kranz");
Serial1.print("!!!");
Serial1.write(0x04); //End Transmission
//delay (5000);
}
if (month() == 5 && day() == 4 && second() == 40)
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("Happy ");
MLeMayBD = year() - 1977;
Serial1.print(MLeMayBD);
if (MLeMayBD == 11){
Serial.print("th ");
}
else if (MLeMayBD == 1 || MLeMayBD == 21 || MLeMayBD == 31 || MLeMayBD == 41 || MLeMayBD == 51 || MLeMayBD == 61 || MLeMayBD == 71 || MLeMayBD == 81 || MLeMayBD == 91 || MLeMayBD == 101){
Serial1.print("st ");
}
else if (MLeMayBD == 2 || MLeMayBD == 22 || MLeMayBD == 32 || MLeMayBD == 42 || MLeMayBD == 52 || MLeMayBD == 62 || MLeMayBD == 72 || MLeMayBD == 82 || MLeMayBD == 92 || MLeMayBD == 102){
Serial1.print("nd ");
}
else if (MLeMayBD == 3 || MLeMayBD == 23 || MLeMayBD == 33 || MLeMayBD == 43 || MLeMayBD == 53 || MLeMayBD == 63 || MLeMayBD == 73 || MLeMayBD == 83 || MLeMayBD == 93 || MLeMayBD == 103){
Serial1.print("rd ");
}
else
{
Serial1.print("th ");
}
Serial1.print("Birthday");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print("Michael LeMay");
Serial1.print("!!!");
Serial1.write(0x04); //End Transmission
//delay (5000);
}
// if (month() == 12 && day() == 16 && second() == 50)
// {
// for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
// Serial1.write(0x01); //Start of Header
// Serial1.write("Z00"); //All sign types, (00 all addresses)
// Serial1.write(0x02); //Start of text
// Serial1.write("AA"); //Write Text File
// Serial1.write(0x1b); //Escape
// Serial1.write(0x22); //Top Line
// Serial1.write(0x62); //Hold
// Serial1.print("Happy ");
// LarryBD = year() - 1983;
// Serial1.print(LarryBD);
// if (LarryBD == 11){
// Serial.print("th ");
// }
// else if (LarryBD == 1 || LarryBD == 21 || LarryBD == 31 || LarryBD == 41 || LarryBD == 51 || LarryBD == 61 || LarryBD == 71 || LarryBD == 81 || LarryBD == 91 || LarryBD == 101){
// Serial1.print("st ");
// }
// else if (LarryBD == 2 || LarryBD == 22 || LarryBD == 32 || LarryBD == 42 || LarryBD == 52 || LarryBD == 62 || LarryBD == 72 || LarryBD == 82 || LarryBD == 92 || LarryBD == 102){
// Serial1.print("nd ");
// }
// else if (LarryBD == 3 || LarryBD == 23 || LarryBD == 33 || LarryBD == 43 || LarryBD == 53 || LarryBD == 63 || LarryBD == 73 || LarryBD == 83 || LarryBD == 93 || LarryBD == 103){
// Serial1.print("rd ");
// }
// else
// {
// Serial1.print("th ");
// }
// Serial1.print("Birthday");
// Serial1.write(0x1b); //Escape
// Serial1.write(0x26); //Bottom Line
// Serial1.write(0x62); //Hold
// Serial1.print("Larry Kranz");
// Serial1.print("!!!");
// Serial1.write(0x04); //End Transmission
// //delay (5000);
// }
if (month() == 1 && day() == 23 && second() == 50)
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("Happy ");
MichelleLeMayBD = year() - 1976;
Serial1.print(MichelleLeMayBD);
if (MichelleLeMayBD == 11){
Serial.print("th ");
}
else if (MichelleLeMayBD == 1 || MichelleLeMayBD == 21 || MichelleLeMayBD == 31 || MichelleLeMayBD == 41 || MichelleLeMayBD == 51 || MichelleLeMayBD == 61 || MichelleLeMayBD == 71 || MichelleLeMayBD == 81 || MichelleLeMayBD == 91 || MichelleLeMayBD == 101){
Serial1.print("st ");
}
else if (MichelleLeMayBD == 2 || MichelleLeMayBD == 22 || MichelleLeMayBD == 32 || MichelleLeMayBD == 42 || MichelleLeMayBD == 52 || MichelleLeMayBD == 62 || MichelleLeMayBD == 72 || MichelleLeMayBD == 82 || MichelleLeMayBD == 92 || MichelleLeMayBD == 102){
Serial1.print("nd ");
}
else if (MichelleLeMayBD == 3 || MichelleLeMayBD == 23 || MichelleLeMayBD == 33 || MichelleLeMayBD == 43 || MichelleLeMayBD == 53 || MichelleLeMayBD == 63 || MichelleLeMayBD == 73 || MichelleLeMayBD == 83 || MichelleLeMayBD == 93 || MichelleLeMayBD == 103){
Serial1.print("rd ");
}
else
{
Serial1.print("th ");
}
Serial1.print("Birthday");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print("Michelle LeMay");
Serial1.print("!!!");
Serial1.write(0x04); //End Transmission
//delay (5000);
}
if (month() == 8 && day() == 29 && second() == 50)
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("Happy ");
KWicksBD = year() - 1955;
Serial1.print(KWicksBD);
if (KWicksBD == 11){
Serial.print("th ");
}
else if (KWicksBD == 1 || KWicksBD == 21 || KWicksBD == 31 || KWicksBD == 41 || KWicksBD == 51 || KWicksBD == 61 || KWicksBD == 71 || KWicksBD == 81 || KWicksBD == 91 || KWicksBD == 101){
Serial1.print("st ");
}
else if (KWicksBD == 2 || KWicksBD == 22 || KWicksBD == 32 || KWicksBD == 42 || KWicksBD == 52 || KWicksBD == 62 || KWicksBD == 72 || KWicksBD == 82 || KWicksBD == 92 || KWicksBD == 102){
Serial1.print("nd ");
}
else if (KWicksBD == 3 || KWicksBD == 23 || KWicksBD == 33 || KWicksBD == 43 || KWicksBD == 53 || KWicksBD == 63 || KWicksBD == 73 || KWicksBD == 83 || KWicksBD == 93 || KWicksBD == 103){
Serial1.print("rd ");
}
else
{
Serial1.print("th ");
}
Serial1.print("Birthday");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print("Kathy Wicks");
Serial1.print("!!!");
Serial1.write(0x04); //End Transmission
//delay (5000);
}
if (month() == 4 && day() == 23 && second() == 50)
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("Happy ");
ADavisBD = year() - 1979;
Serial1.print(ADavisBD);
if (ADavisBD == 11){
Serial.print("th ");
}
else if (ADavisBD == 1 || ADavisBD == 21 || ADavisBD == 31 || ADavisBD == 41 || ADavisBD == 51 || ADavisBD == 61 || ADavisBD == 71 || ADavisBD == 81 || ADavisBD == 91 || ADavisBD == 101){
Serial1.print("st ");
}
else if (ADavisBD == 2 || ADavisBD == 22 || ADavisBD == 32 || ADavisBD == 42 || ADavisBD == 52 || ADavisBD == 62 || ADavisBD == 72 || ADavisBD == 82 || ADavisBD == 92 || ADavisBD == 102){
Serial1.print("nd ");
}
else if (ADavisBD == 3 || ADavisBD == 23 || ADavisBD == 33 || ADavisBD == 43 || ADavisBD == 53 || ADavisBD == 63 || ADavisBD == 73 || ADavisBD == 83 || ADavisBD == 93 || ADavisBD == 103){
Serial1.print("rd ");
}
else
{
Serial1.print("th ");
}
Serial1.print("Birthday");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print("Adam & Albert Davis");
Serial1.print("!!!");
Serial1.write(0x04); //End Transmission
//delay (5000);
}
// Holidays
if (month() == 1 && day() == 1 && second() == 50)
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("Happy New Year");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print(year());
Serial1.print("!!!");
Serial1.write(0x04); //End Transmission
//delay (5000);
}
if (year() == 2018 && month() == 4 && day() == 1 && second() == 40)
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x63); //Flash
Serial1.print("WARNING!!!");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print("APRIL FOOLS DAY");
Serial1.print("!!!");
Serial1.write(0x04); //End Transmission
//delay (5000);
}
if (year() == 2018 && month() == 4 && day() == 1 && second() == 50 || year() == 2019 && month() == 4 && day() == 21 && second() == 50 || year() == 2020 && month() == 4 && day() == 12 && second() == 50 || year() == 2021 && month() == 4 && day() == 4 && second() == 50 || year() == 2022 && month() == 4 && day() == 17 && second() == 50 || year() == 2023 && month() == 4 && day() == 9 && second() == 50 || year() == 2024 && month() == 3 && day() == 31 && second() == 50 || year() == 2025 && month() == 4 && day() == 20 && second() == 50 || year() == 2026 && month() == 4 && day() == 5 && second() == 50 || year() == 2027 && month() == 3 && day() == 28 && second() == 50 || year() == 2028 && month() == 4 && day() == 16 && second() == 50 || year() == 2029 && month() == 4 && day() == 1 && second() == 50 || year() == 2030 && month() == 4 && day() == 21 && second() == 50 || year() == 2031 && month() == 4 && day() == 13 && second() == 50 || year() == 2032 && month() == 3 && day() == 28 && second() == 50 || year() == 2033 && month() == 4 && day() == 17 && second() == 50 || year() == 2034 && month() == 4 && day() == 9 && second() == 50 || year() == 2035 && month() == 3 && day() == 25 && second() == 50 || year() == 2036 && month() == 4 && day() == 13 && second() == 50 || year() == 2037 && month() == 4 && day() == 1 && second() == 50)
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("Happy");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print("Easter");
Serial1.print("!!!");
Serial1.write(0x04); //End Transmission
//delay (5000);
}
if (month() == 7 && day() == 4 && second() == 50)
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("Happy");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print("Independence Day");
Serial1.print("!!!");
Serial1.write(0x04); //End Transmission
//delay (5000);
}
if (month() == 11 && day() > 22 && day() < 29 && weekday() == 5 && second() == 50)
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("Happy");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print("Thanksgiving");
Serial1.print("!!!");
Serial1.write(0x04); //End Transmission
//delay (5000);
}
if (month() == 5 && day() == 4 && second() == 50)
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("May the Fourth");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print("be with you");
Serial1.print(".");
Serial1.write(0x04); //End Transmission
//delay (5000);
}
SWS = digitalRead(SW1);
if (SWS == 1)
{
DNE();
}
}
}
void DNE() {
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial.println("Do Not Enter!!!");
Serial1.write(0x01); //Start of Header
//Serial1.write(); //Sign Type Code (Optional)
Serial1.write("Z00"); //Sign address
//Serial1.write(0x5D); //Exception Code
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("RECORDING IN PROGRESS");
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x63); //Flash
Serial1.print("DO NOT ENTER!!!");
Serial1.write(0x04); //End Transmission
while (digitalRead(SW1) == 1) {
testing();
}}
void testing() {
SWS = digitalRead(SW1);
if (SWS == 1)
{
digitalWrite(led, HIGH);
delay(100);
digitalWrite(led, LOW);
delay(100);
return;
}}
void time()
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
if (weekday() == 1){
Serial1.print("Sunday ");
}
if (weekday() == 2){
Serial1.print("Monday ");
}
if (weekday() == 3){
Serial1.print("Tuesday ");
}
if (weekday() == 4){
Serial1.print("Wednesday ");
}
if (weekday() == 5){
Serial1.print("Thursday ");
}
if (weekday() == 6){
Serial1.print("Friday ");
}
if (weekday() == 7){
Serial1.print("Saturday ");
}
if (hour() == 0){
Serial1.print("12");
}
else if (hour() > 12){
H = hour() - 12;
Serial1.print(H);
}
else
{
Serial1.print(hour());
}
Serial1.print(":");
if (minute() < 10)
{
Serial1.print("0");
}
Serial1.print(minute());
if (hour() < 12){
Serial1.print("AM");
}
else
{
Serial1.print("PM");
}
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
if (month() == 1){
Serial1.print("January ");
}
if (month() == 2){
Serial1.print("Febuary ");
}
if (month() == 3){
Serial1.print("March ");
}
if (month() == 4){
Serial1.print("April ");
}
if (month() == 5){
Serial1.print("May ");
}
if (month() == 6){
Serial1.print("June ");
}
if (month() == 7){
Serial1.print("July ");
}
if (month() == 8){
Serial1.print("August ");
}
if (month() == 9){
Serial1.print("September ");
}
if (month() == 10){
Serial1.print("October ");
}
if (month() == 11){
Serial1.print("November ");
}
if (month() == 12){
Serial1.print("December ");
}
Serial1.print(day());
Serial1.print(", ");
Serial1.print(year());
Serial1.write(0x04); //End Transmission
loop();
//delay (50000);
}
void Temperature()
{
for (int i = 0; i < 10; i++) Serial1.write(0x00); //String of Nulls
Serial1.write(0x01); //Start of Header
Serial1.write("Z00"); //All sign types, (00 all addresses)
Serial1.write(0x02); //Start of text
Serial1.write("AA"); //Write Text File
Serial1.write(0x1b); //Escape
Serial1.write(0x26); //Bottom Line
Serial1.write(0x62); //Hold
Serial1.print("Humidity: ");
Serial1.print(hdc1080.readHumidity());
Serial1.print("%");
Serial1.write(0x1b); //Escape
Serial1.write(0x22); //Top Line
Serial1.write(0x62); //Hold
Serial1.print("Temp: ");
Serial1.print(hdc1080.readTemperature()*1.8+32); //Convert Celcus to Farenheight
Serial1.print("F / ");
Serial1.print(hdc1080.readTemperature());
Serial1.print("C");
Serial1.write(0x04); //End Transmission
loop();
//delay (10000);
}
//More Timekeeping
void digitalClockDisplay() {
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.print(" ");
Serial.print(day());
Serial.print(" ");
Serial.print(month());
Serial.print(" ");
Serial.print(year());
Serial.println();
}
time_t getTeensy3Time()
{
return Teensy3Clock.get();
}
// code to process time sync messages from the serial port
#define TIME_HEADER "T" // Header tag for serial time sync message
unsigned long processSyncMessage() {
unsigned long pctime = 0L;
const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013
if(Serial.find(TIME_HEADER)) {
pctime = Serial.parseInt();
return pctime;
if( pctime < DEFAULT_TIME) { // check the value is a valid time (greater than Jan 1 2013)
pctime = 0L; // return 0 to indicate that the time is not valid
}
}
return pctime;
}
void printDigits(int digits){
// utility function for digital clock display: prints preceding colon and leading 0
Serial.print(":");
if(digits < 10)
Serial.print('0');
Serial.print(digits);
}
Processing Time Set:
Code:
/**
* SyncArduinoClock.
*
* portIndex must be set to the port connected to the Arduino
*
* The current time is sent in response to request message from Arduino
* or by clicking the display window
*
* The time message is 11 ASCII text characters; a header (the letter 'T')
* followed by the ten digit system time (unix time)
*/
import processing.serial.*;
import java.util.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;
public static final short portIndex = 4; // select the com port, 0 is the first port
public static final String TIME_HEADER = "T"; //header for arduino serial time message
public static final char TIME_REQUEST = 7; // ASCII bell character
public static final char LF = 10; // ASCII linefeed
public static final char CR = 13; // ASCII linefeed
Serial myPort; // Create object from Serial class
void setup() {
size(200, 200);
println(Serial.list());
println(" Connecting to -> " + Serial.list()[portIndex]);
myPort = new Serial(this,Serial.list()[portIndex], 9600);
println(getTimeNow());
}
void draw()
{
textSize(20);
textAlign(CENTER);
fill(0);
text("Click to send\nTime Sync", 0, 75, 200, 175);
if ( myPort.available() > 0) { // If data is available,
char val = char(myPort.read()); // read it and store it in val
if(val == TIME_REQUEST){
long t = getTimeNow();
sendTimeMessage(TIME_HEADER, t);
}
else
{
if(val == LF)
; //igonore
else if(val == CR)
println();
else
print(val); // echo everying but time request
}
}
}
void mousePressed() {
sendTimeMessage( TIME_HEADER, getTimeNow());
}
void sendTimeMessage(String header, long time) {
String timeStr = String.valueOf(time);
myPort.write(header); // send header and time to arduino
myPort.write(timeStr);
myPort.write('\n');
}
long getTimeNow(){
// java time is in ms, we want secs
Date d = new Date();
Calendar cal = new GregorianCalendar();
long current = d.getTime()/1000;
long timezone = cal.get(cal.ZONE_OFFSET)/1000;
long daylight = cal.get(cal.DST_OFFSET)/1000;
return current + timezone + daylight;
}
I don't have any issues with setting the time once the program is loaded. Every once in a while, I update the time to account for drift in the Teensy's RTC.
The display is connected to the processor using a single channel HEX-FET (IRFD110) and an RS-232 interface (SP-233). I also get temperature and humidity from a Texas Instruments HDC 1080 on the I2C Bus. Battery backup is provided by a KEMET FE0H155ZF Supercapacitor instead of a battery. I can make a connection diagram if necessary.
If someone can help me figure out why this suddenly compile, I would appreciate it.
Nothing has changed since the last time this sketch was compiled, same sketch with no changes, same processor, same computer, new house, which is why I'm perplexed and seeking help.