Here's one I found. Where it says Serial.begin(9600); it says expected constructor, destructor, or type conversion before'.' token.
Code:
// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
void setup () {
Serial.begin(57600);
Wire.begin();
RTC.begin();
if (! RTC.isrunning()) {
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
RTC.adjust(DateTime(__DATE__, __TIME__));
}
}
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(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
Serial.print(" since midnight 1/1/1970 = ");
Serial.print(now.unixtime());
Serial.print("s = ");
Serial.print(now.unixtime() / 86400L);
Serial.println("d");
// calculate a date which is 7 days and 30 seconds into the future
DateTime future (now.unixtime() + 7 * 86400L + 30);
Serial.print(" now + 7d + 30s: ");
Serial.print(future.year(), DEC);
Serial.print('/');
Serial.print(future.month(), DEC);
Serial.print('/');
Serial.print(future.day(), DEC);
Serial.print(' ');
Serial.print(future.hour(), DEC);
Serial.print(':');
Serial.print(future.minute(), DEC);
Serial.print(':');
Serial.print(future.second(), DEC);
Serial.println();
Serial.println();
delay(3000);
}
Serial.begin(9600);
// code courtesy of Mr. BroHogan (a.k.a. "Life Clock");
Wire.beginTransmission(0x68);
Wire.send(0x07);
Wire.send(0x90); // 0x90=1Hz, 0x91=4kHz, 0x92=8kHz, 0x93=32kHz
Wire.endTransmission();
/*
DS1307 Square-wave machine
Used to demonstrate the four different square-wave outputs from Maxim DS1307
See page nine of data sheet for more information
John Boxall - tronixstuff.wordpress.com
*/
#include "Wire.h"
#define DS1307_I2C_ADDRESS 0x68 // each I2C object has a unique bus address, the DS1307 is 0x68
void setup()
{
Wire.begin();
}
void sqw1() // set to 1Hz
{
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.write(0x07); // move pointer to SQW address
Wire.write(0x10); // sends 0x10 (hex) 00010000 (binary)
Wire.endTransmission();
}
void sqw2() // set to 4.096 kHz
{
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.write(0x07); // move pointer to SQW address
Wire.write(0x11); // sends 0x11 (hex) 00010001 (binary)
Wire.endTransmission();
}
void sqw3() // set to 8.192 kHz
{
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.write(0x07); // move pointer to SQW address
Wire.write(0x12); // sends 0x12 (hex) 00010010 (binary)
Wire.endTransmission();
}
void sqw4() // set to 32.768 kHz (the crystal frequency)
{
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.write(0x07); // move pointer to SQW address
Wire.write(0x13); // sends 0x13 (hex) 00010011 (binary)
Wire.endTransmission();
}
void sqwOff()
// turns the SQW off
{
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.write(0x07); // move pointer to SQW address
Wire.write(0x00); // turns the SQW pin off
Wire.endTransmission();
}
void loop()
{
sqw1();
delay(5000);
sqw2();
delay(5000);
sqw3();
delay(5000);
sqw4();
delay(5000);
sqwOff();
delay(5000);
}
ok after bending my head again and googling your fault I found a nice little page that explained something that made sense to an extent, then I had to go looking. ok first rule of arduino is don't talk about fight club... wait
all kidding aside if you type the error into google, google usually has an answer in this case
http://stackoverflow.com/questions/...or-destructor-or-type-conversion-before-token became useful. so something in that code is not in a function.
now the sketch error on mine says
sketch_oct14a:64: error: expected constructor, destructor, or type conversion before '.' token
sketch_oct14a:66: error: expected constructor, destructor, or type conversion before '.' token
sketch_oct14a:67: error: expected constructor, destructor, or type conversion before '.' token
sketch_oct14a:68: error: expected constructor, destructor, or type conversion before '.' token
sketch_oct14a:69: error: expected constructor, destructor, or type conversion before '.' token
sketch_oct14a is the sketch name the next digits are the line of code that is wrong.
in this case
Wire.beginTransmission(0x68);
Wire.send(0x07);
Wire.send(0x90); // 0x90=1Hz, 0x91=4kHz, 0x92=8kHz, 0x93=32kHz
Wire.endTransmission();
ok now as to how to fix it....... yeah I can see whats wrong, I can't see how to fix it.. someone who knows how to code might figure it out
also a few additions is that as of arduino 1.0 wire.write has to change to wire.send
you have 2 "void loop" functions... that can't be good
2 void setup functions, as above
and without the library of RTCLIB.h file you have I won't be able to get the rest