Show Posts
Pages: [1] 2 3
1  Using Arduino / Programming Questions / Re: Questing using requestSync() in the Time library on: February 18, 2014, 10:11:36 am
Thanks for responding.  Two very good and valid points. It looks like
I need the "Processing" sketch running to enable the PC to "listen".

2  Using Arduino / Programming Questions / Questing using requestSync() in the Time library on: February 17, 2014, 08:35:30 pm
I'm trying to use the TimeSerial example in the Time library examples to understand getting
a unix time serial value.  I've loaded the TimeSerial example and it compiles fine (Using
Arduino 1.0.5-r2)  When I run the sketch and open the serial monitor, I get the following
message, "Waiting for sync message".  It will sit there until I enter a unix time serial.
If I enter "T1357041600" and click SEND, it will start posting the time represented
by this unix time serial.  So, I would like to use this sketch to programmatically
retrieve a unix time serial of the current PC time and make it available to breakdown
into a human readable form. 

Question is, how do I submit a time serial to the
serial port without using the keyboard?  I've tried Serial.print("T1357041600") and
Serial.write("T1357041600"). Neither of these will trigger a response from the requestSync()
function.   The TimeSerial sketch code is reproduced here:

 * TimeSerial.pde
 * example code illustrating Time library set through serial port messages.
 * Messages consist of the letter T followed by ten digit time (as seconds since Jan 1 1970)
 * you can send the text on the next line using Serial Monitor to set the clock to noon Jan 1 2013
 * A Processing example sketch to automatically send the messages is inclided in the download
 * On Linux, you can use "date +T%s > /dev/ttyACM0" (UTC time zone)
#include <Time.h> 

#define TIME_HEADER  "T"   // Header tag for serial time sync message
#define TIME_REQUEST  7    // ASCII bell character requests a time sync message

void setup()  {
  while (!Serial) ; // Needed for Leonardo only
  pinMode(13, OUTPUT);
  setSyncProvider( requestSync);  //set function to call when sync required
  Serial.println("Waiting for sync message");

void loop(){   
  if (Serial.available()) {
  if (timeStatus()!= timeNotSet) {
  if (timeStatus() == timeSet) {
    digitalWrite(13, HIGH); // LED on if synced
  } else {
    digitalWrite(13, LOW);  // LED off if needs refresh

void digitalClockDisplay(){
  // digital clock display of the time
  Serial.print(" ");
  Serial.print(" ");
  Serial.print(" ");

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  if(digits < 10)

void processSyncMessage() {
  unsigned long pctime;
  const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013

  if(Serial.find(TIME_HEADER)) {
     pctime = Serial.parseInt();
     if( pctime >= DEFAULT_TIME) { // check the integer is a valid time (greater than Jan 1 2013)
       setTime(pctime); // Sync Arduino clock to the time received on the serial port

time_t requestSync()
  return 0; // the time will be sent later in response to serial mesg
3  Using Arduino / Programming Questions / Re: Arduino 1.0.5-r2 Issue on: February 15, 2014, 08:55:23 pm
RESLOVED!  smiley-confuse
Apparently if you import an "updated" version of the DS1307RTC library from the Ardjuino Time Library in
the Arduino Playground you MUST also import the "updated" version of the TIME library. This is not
clearly stated in the Playground but then again, maybe it is implied that if all three of the libraries in the
Arduino Time Library have been updated, one should import them all!

Thanks to all who responded....
4  Using Arduino / Programming Questions / Re: Arduino 1.0.5-r2 Issue on: February 14, 2014, 10:49:54 am
The Arduino IDE version is 1.0.5-r2 as stated in my original submission.  Following
is the complete error message generated from Arduino v1.0.5-r2:

date_time_v3.cpp.o: In function `loop':
C:\_Development\arduino-1.0.5-r2/date_time_v3.ino:54: undefined reference to `DS1307RTC::read(tmElements_t&)'
date_time_v3.cpp.o: In function `setup':
C:\_Development\arduino-1.0.5-r2/date_time_v3.ino:35: undefined reference to `DS1307RTC::write(tmElements_t&)'

The previous Arduino IDE version, 1.0.5, compiled w/o error.  The library, DS1307RTC, is in the default Arduino library location
and I have verified that it contains definitions for both the 'read' and 'write" functions.

I don't see 1.0.5 in the "old Arduino version" list ??
5  Using Arduino / Programming Questions / Arduino 1.0.5-r2 Issue on: February 14, 2014, 05:35:08 am
I have an RTC project based on the DS1307 RTC that I had been working on with Arduino 1.0.5.  My PC crashed and I
had to reinstall the Arduino IDE and could only find 1.0.5-r2.  It installed fine but the RTC project now
won't compile.  It fails because it can't find two functions (read and write) in the DS1307RTC.h library... 
I've reimported the library and that didn't fix the issue.  Are there any known issues with either this
release of Arduino or the DS1307RTC library?  Is release 1.0.5 available to download anymore?
6  Using Arduino / Programming Questions / Re: Issue with <time.h> setTime() function on: January 20, 2014, 07:13:23 am
I'm able to accomplish what I need by using the RTC.write(tm) function.  The setTime(hr, min, sec, mo, day, year)
function does not seem to work with the RTC.  Using the NTP protocol is not an option as I wanted need to be
able to  set the time offline... RTC.write() is working.... so issue RESOLVED.
Thanks for your quick responses!!   smiley-lol
7  Using Arduino / Programming Questions / Issue with <time.h> setTime() function on: January 19, 2014, 08:25:06 pm
Have an issue setting time using the setTime() function in the time.h library.  See following code:
I am driving a SURE 3208 Led Matrix display using the HT1632.h library functions.
Using the setTime() function -- setTime(4, 11, 15, 19, 1, 2014)  -- doesn't set the
time on a DS1307 RTC module.  It doesn't set the PC System time either but I didn't expect
it to.  The DS1307RTC.h library has a set() function but it expects a EPOCH time which
I am trying to avoid. What time is being set with the time.h setTime() function?

Does anyone know how to set the DS1307 RTC using human readable time vs the EPOCH time code?

[code[font=Courier New][size=8pt][/size]]#include <Time.h> 
#include <Wire.h> 
#include <DS1307RTC.h> 
#include "font_5x4.h"
#include "font_5x7.h"
#include <HT1632.h>
#include <stdio.h>
#include <Button.h>

#define cs1 8
#define cs2 9
#define wrt 10
#define dat 11

#define High 9
#define Mid 5
#define Low 1

int heartbeat = 2;
bool SetTime = 1;  /// 0 = no, 1 = yes
char buff[6];
tmElements_t tm;

void setup()
  pinMode(heartbeat, OUTPUT);
    Serial.println("Setting Time...");
    setTime(4, 11, 15, 19, 1, 2014);
  HT1632.begin(cs1, cs2, wrt, dat);

void loop()
  //clear matrix
    sprintf(buff, "%2d%c%02d", tm.Hour, ':', tm.Minute);
    digitalWrite(heartbeat, HIGH);
    sprintf(buff, "%2d%c%02d", tm.Hour, ' ', tm.Minute);
    digitalWrite(heartbeat, LOW);

void displayit( char msg[], int x_offset, int y_offset)
  /**************** DO NOT DELETE ****************
    drawText SYNTAX:
      const char text [],
      int x,
      int y,
      const char font [],
      const char font_width [],
      char font_height,
      int font_glyph_step,
      char gutter_space)
  HT1632.drawText((const char *)&msg[0], x_offset, y_offset, FONT_5X7, FONT_5X7_WIDTH, FONT_5X7_HEIGHT, FONT_5X7_STEP_GLYPH);

void digitalClockDisplay()
  // digital clock display of the time
  Serial.print(" ");

void printDigits(int digits)
  // utility function for digital clock display: prints preceding colon and leading 0
  if(digits < 10)
8  Using Arduino / Programming Questions / Re: Using Keypad.h with a matrix keypad on: March 06, 2013, 06:42:45 pm
Thanks guys.... I had a mind lapse...  these were great
suggestions and they worked....!!
9  Using Arduino / Programming Questions / Using Keypad.h with a matrix keypad on: March 06, 2013, 03:03:54 pm
Looking for suggestions... I want to promt the user to take an action (like select a menu item)
then select the option from a keypad.  I'm using the Keypad.h library with a 4x4 matrix keypad.
I send the prompt to the serial device Serial.print("Select desired menu item); I then want
to go into a loop and wait for a keypress i.e. char key = keypad.getKey();  I want the function
to be "blocking".  the Keypad.h function getKey() is non-blocking.  If I use something
like  keypad.waitForKey(); it returns a value of 0x00 when a key is pressed and if I follow
the waitForKey() function with a  key = keypad.getKey(); the value of key is null.

Anyone have a structure that will wait for a keypress (blocking) and return the key value
when a key is pressed???
10  Using Arduino / Programming Questions / Re: Saving Sketches on: February 24, 2013, 05:37:38 pm
Good question regarding where I was saving the file.  It was started in the libraries folder...  I moved it
from the libraries folder to a separate folder in the IDE environment and it saves without the
prompt.... smiley-red  problem solved.... thank you!!
11  Using Arduino / Programming Questions / Saving Sketches on: February 24, 2013, 05:10:47 pm
Why does the IDE prompt me to save my sketch with a different name everytime I make a change
to the sketch and click "save"?  It tells me, "some files are 'read-only' and to rename the sketch". 
The previously saved sketch is NOT flagged by the OS as 'read-only' -- this is very annoying to have
to rename the sketch whenever I modify/tweak it... ???

12  Using Arduino / Displays / Re: Unknown LCD - Longshot on: January 25, 2013, 10:08:14 am
Thanks all... good pointers...   
13  Using Arduino / Displays / Re: Unknown LCD - Longshot on: January 25, 2013, 05:03:14 am
I've attached a picture with a few notations.  I've discovered that ALL of the terminals
marked as "-" are common as are the "+" terminals (although the appearance that
the "+" terminals may be common could be the result of some back circuits.....). 
I tend to aggree the first "+" terminal is probably a backlight and the "+" terminal
adjacent to the "TX" terminal is supply. The 8-pos switch probably sets the buaud rate
and other configurations but I've tried setting it to various random positions with no
observable change. 
14  Using Arduino / Displays / Unknown LCD - Longshot on: January 24, 2013, 09:57:37 pm
I found an unknown LCD in the local elec. surplus store and have been challenged to make it work.
It is a 2 x 16  display (5x7 block).  It has a serial interface (no manufacture ID although a Bing
search on an assy # on the board points to a url for "IndustrialElectricDirect" but the url registration
has expired.  There is an 8 pos screw terminal connector with the following lables:

 1   2   3    4   5    6   7   8
 + | - | - | RX | - | TX | + | -

There is a 7805 regulator on the board so I applied +9V to pins 7 and 8.  This causes a underbar
cursor to be displayed in pos 0 (row 1, col 1).  I've found that pins 3, 5 and 8 are all common grounds.
Pins 1 and 2 are isolated (pin 2 is not connected to pins 3, 5 or 8 ).  Pin 1 is not connected to
the +5V regulator output.   I've connected pin 4 (RX) to my Arduino UNO pin 1 (tx) and pump
an ascii letter 'A' to it and cycle thru baud rates from 1200 to 38400... but the cursor never moves nor
does the letter 'A' appear.   

Its a longshot that someone might recognize the LCD based on the 8-pin screw terminal connector
15  Using Arduino / Installation & Troubleshooting / Re: avrdude: stk500_getsync(): not in sync: resp=0x30 on: January 05, 2013, 07:53:11 pm
Add me to the ever growing list of "not in sync" errors.  I'm using an Arduino UNO R3 / ZUMO Shield combo.
Had been working for a couple of hours then all of a sudden I started getting the subject error.
It started as an intermittent failure and is now solid.  I've tried all the tips suggested in this post as
well as others in this forum.  None work.  I've even update Arduino 1.0.1 to 1.0.3 and updated the USB drivers,
all to no avail....   ?????
Pages: [1] 2 3