Show Posts
Pages: [1] 2 3
1  Forum 2005-2010 (read only) / Troubleshooting / Re: New code not running despite flawless flash on: July 15, 2007, 01:42:59 pm
I have noticed an uploading sensitivity with the ide and an Arduino executing an older program with serial out connected to either the ide terminal or another terminal. I have always made it work by varying the timing on when I reset the board versus when I hit the upload button on the ide. On my newer PC the upload handshake is fast so you need to be quick about it. Also make sure you have any additional terminal emulators off when you upload.
2  Forum 2005-2010 (read only) / Troubleshooting / printf on: September 18, 2007, 07:00:48 pm
Should I expect printf to work? If I include stdio.h programs compile without error but nothing is printed back to the ide.

 
  #include <stdio.h>
 void setup(){
   beginSerial(19200);
 }
 
  void loop()
    {
        int luckyNumber = 5;
        float radius = 2;
        char myName[15] = "John";
        char initial = 'J';

        printf("Hello World\n");      
        printf("My lucky number is %d\n", luckyNumber);            
        printf("My name is %s\n",myName);        
        printf("My first initial is %c\n",initial);              
        printf("The area of a circle with radius %f is %f\n",                3.14*radius*radius);
       //Serial.println(luckyNumber);
    }

3  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: mini RTOS [sic] on: September 25, 2008, 05:40:07 pm
mem,
Did you mean TimerAlarms.h ? I tried commenting out the include in TimerAlarms.h but it did not work. Same kind of errors at compile time. Any other ideas? I am using the Mac version.
4  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: mini RTOS [sic] on: September 24, 2008, 05:45:51 pm
mem,
can you tell me what to modify to get your dateTimeAlarm library to run with 0012? I am seeing the
same kind of library compile errors others have seen with moving to 0012
5  Forum 2005-2010 (read only) / Syntax & Programs / Re: Arduino Clock: Setting Time on: April 16, 2009, 01:51:41 pm
I saw this too and changed the second test in the if statement to:

previousMidnight(DateTime.now())+ alarmOffTime;

and it worked for me.
6  Forum 2005-2010 (read only) / Syntax & Programs / Re: DateTime question on: April 13, 2009, 05:25:22 pm
Yes. The second test in the if statement needs to be previousMidnight(DateTime.now()) + alarmOffTime and
everything works. Thanks.
7  Forum 2005-2010 (read only) / Syntax & Programs / DateTime question on: April 09, 2009, 05:23:28 pm
Mem:
In another thread you suggested the following code using DateTime to turn an led on for a specific length of time at a specific time of day.

Code:
time_t  alarmOnTime =  (8 * SECS_PER_HOUR) + (30 * SECS_PER_MIN);
time_t  alarmOffTime =  alarmOnTime  + (60 * SECS_PER_MIN);
time_t nextAlarm;


nextAlarm =  previousMidnight(DateTime.now())+ alarmOnTime;

if( DateTime.now() >= nextAlarm  && DateTime.now()  < nextAlarm + alarmOffTime )
    digitalWrite(ledPin), HIGH);
else
   digitalWrite(ledPin), LOW);

I attempted to put this in a sketch to try as follows:

Code:
#include <DateTime.h>
int ledPin=13;
#define START_TIME 1239202500 // set this to the Unix start time you want (0 is midnight Jan1 1970 UTC)
//get unix time code from  http://www.onlineconversion.com/unix_time.htm
 time_t  alarmOnTime =  (14 * SECS_PER_HOUR) +( 56 * SECS_PER_MIN);  //2:56
 time_t  alarmOffTime =  alarmOnTime  + (01 * SECS_PER_MIN);  //one minute
 time_t nextAlarm;
void setup(){
  Serial.begin(9600);
  pinMode(ledPin,OUTPUT);
  DateTime.sync(START_TIME);

}

void loop(){
  nextAlarm =  previousMidnight(DateTime.now())+ alarmOnTime;

  if( DateTime.now() >= nextAlarm  && DateTime.now()  < nextAlarm + alarmOffTime )
    digitalWrite((ledPin), HIGH);
  else
    digitalWrite((ledPin), LOW);

}

It turns on the led at the proper time, but it never turns it off. I put in some print statements and can see the times are all doing the right thing, but I cannot figure out why the led is never turned off. Any ideas?

8  Forum 2005-2010 (read only) / Interfacing / Re: Serial data to Visual Basic, Visual C++, Java on: April 26, 2008, 03:34:13 pm
You might try Processing at http://processing.org/. It uses much the same IDE as the Arduino and is similar in many other respects. There are many examples on the Forum and elsewhere to provide the capability you are seeking.
9  Forum 2005-2010 (read only) / Interfacing / Re: problems with Processing on: March 29, 2008, 08:49:18 pm
I have had this problem if I inadvertently also turned on the Arudino's IDE serial monitoring. You cannot have both the Arduino and Processing monitoring the same serial port.
10  Forum 2005-2010 (read only) / Development / Re: Tiny - Oscillator or Crystal? on: September 23, 2010, 06:39:12 pm
The internal oscillator at 8mhz.
11  Forum 2005-2010 (read only) / Development / Re: Who needs a Software Real Time Clock? on: December 18, 2008, 06:44:41 pm
mem:
After an absence I got back to this project and this time was able to get it working on a different mac with no problem on arduino 11. It runs for days with no problems. Now I cannot get it to compile on arduino 12 as it consistently is giving stdlib.h errors. I have tried the newest playground files. Anything you could point me to would be appreciated.
12  Forum 2005-2010 (read only) / Development / Re: Who needs a Software Real Time Clock? on: November 13, 2008, 10:39:12 am
mem:
Good news. I had done what you suggested and it still did not run on 0011. But I moved to 0012 and it just ran correctly overnight! I will investigate and see if I see anything further on 0011, but probably just
move to 0012 for this project. Thanks for your help.
13  Forum 2005-2010 (read only) / Development / Re: Who needs a Software Real Time Clock? on: November 12, 2008, 06:38:52 pm
mem:
I tried the latest libraries from the Playground and the behavior in the same sketch is the same. Runs for while, freezes and jumps to new random time restart.
14  Forum 2005-2010 (read only) / Development / Re: Who needs a Software Real Time Clock? on: November 12, 2008, 02:55:35 pm
mem:

I will try the new DateTimeStrings.cpp, but with the older version commented out as you suggested my sketch still freezes after running a short time and then jumps to some new random time. The other sketch you asked me to try runs for 24 hours without problems. I am using a Mac for development. This is all still on 0011
15  Forum 2005-2010 (read only) / Development / Re: Who needs a Software Real Time Clock? on: November 11, 2008, 10:51:53 am
mem:

I tried your suggested sketch as below:

#include <DateTime.h>
#include <DateTimeStrings.h>

#define START_TIME 1226243400  // set this to the Unix start time you want (0 is midnight Jan1 1970 UTC)
//get unix time code from  http://www.onlineconversion.com/unix_time.htm
void setup(){
  Serial.begin(9600);
  pinMode(13,OUTPUT); // we flash the LED each second
  DateTime.sync(START_TIME);
}

void  loop(){
  unsigned long  prevtime;
 // if(DateTime.available()) { // update clocks if time has been synced
    digitalWrite(13,LOW);  // first flash the LED
    prevtime = DateTime.now();
    while( prevtime == DateTime.now() )  // wait for the second to rollover
        ;
  //{        // the following lines to be added to your test sketch
   //    Serial.print(millis(),DEC);
       delay(1500); // this reduces the number of serial message sent  
  // }

    DateTime.available(); //refresh the Date and time properties
    digitalClockDisplay( );   // update digital clock
    digitalWrite(13,HIGH);
 // }
  delay(100);
}

void digitalClockDisplay(){
  // digital clock display of current date and time
  Serial.print(DateTime.Hour,DEC);
  printDigits(DateTime.Minute);
  printDigits(DateTime.Second);
  Serial.print(" ");
  Serial.print(DateTimeStrings.dayStr(DateTime.DayofWeek));
  Serial.print(" ");
  Serial.print(DateTimeStrings.monthStr(DateTime.Month));
  Serial.print(" ");
  Serial.println(DateTime.Day,DEC);
}

void printDigits(byte digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits,DEC);
}

I used the latest library from the playground and 0011. I tried both an older NG board as well as a Deicimilla board. In all cases the program compiles and runs for anywhere from a minute to several minutes, freezes and usually restarts again at some random date. It seems to run longer with the 1.5 second delay inserted after the second rollover while loop. Any suggestions? Thanks.
Pages: [1] 2 3