Show Posts
Pages: 1 2 [3] 4 5 ... 110
31  Using Arduino / Programming Questions / Re: RTC interrupt does not wake up my Arduino on: August 10, 2014, 01:59:54 pm
isr() and enterSleep() don't need to attach/detach the interrupt and the isr() should not use RTC.setRegister.
So, the isr() function is simply this:
Code:
void isr(){   // ISR function
}

enterSleep is this:
Code:
void enterSleep(){  // function for entering sleep mode
  digitalWrite(ledPin, LOW);

  set_sleep_mode(SLEEP_MODE_PWR_SAVE);
  
  sleep_enable();
  
  sleep_mode();
  
  sleep_disable();
  power_all_enable();
}

and loop() does the reset of the interrupt:
Code:
void loop(){
 
  digitalWrite(ledPin, HIGH);
  delay(100);
  
  enterSleep();
  RTC.setRegister(STAREG, B00000000); // resetting alarm flag
  
}

and BTW
Code:
attachInterrupt(int_number, isr, FALLING);
is correct. You do need FALLING - not LOW.

Pete
32  Using Arduino / Programming Questions / Re: what is the argument on: August 10, 2014, 12:31:34 pm
Quote
void rainbowCycle(uint8_t wait) {

Calling rainbowCycle(1000) is not going to work as intended because you can't cram 1000 into a uint8_t.

Pete
33  Using Arduino / Programming Questions / Re: Example needed for DS3231 AT24C32 IIC Precision RTC on: August 10, 2014, 10:20:00 am
Quote
it seems to me that i need to set the day, hour, minute, (and second in case of the Alarm 1), each time the alarm is triggered
No, you only need to set those values once. The clock then compares the current time against the values in the registers and an alarm/interrupt is generated if all the specified ones match. For an alarm once an hour I think you will need:
Code:
setA1Time(0, 0, 0, 0, b1100, 0, false, false)
The values for day and hour will be ignored.
You will still need to clear the A1F or A2F alarm flag after each interrupt but that is all that's required. The clock will keep ticking and comparing the time against the alarm registers and fire off another interrupt when there's a match which will be one hour later.

Pete
34  Using Arduino / Project Guidance / Re: reading 1000ths of a seconds from a pcf8583 rtc on: August 09, 2014, 09:20:38 pm
Quote
The chip has a register for hundredths of a second
Dunno how I missed that  smiley-red
Looks like it can be set up to interrupt at 100Hz which would make the timing easy if 100ths of a sec are what are required. But the required accuracy of the RTC is still the main issue.

Pete
35  Using Arduino / Programming Questions / Re: Example needed for DS3231 AT24C32 IIC Precision RTC on: August 09, 2014, 06:12:02 pm
Table 2 on page 12 of the datasheet shows what is required to get an alarm once an hour. You can set Alarm1 to interrupt whenever minutes and seconds match (set them both to zero) or set Alarm2 to interrupt whenever the minutes match (set it to zero).
When the clock interrupts you must reset the A1F or A2F alarm flag (but not from within the interrupt routine).

Pete
36  Using Arduino / Project Guidance / Re: reading 1000ths of a seconds from a pcf8583 rtc on: August 09, 2014, 05:49:34 pm
The datasheet for the chip says it can generate a 32768Hz interrupt or it has a pre-scaler which can divide the 32768Hz down by a factor of up to 100. However, the RTC is only as accurate as the 32768Hz crystal that you provide and it probably won't be any better than what you'd get if you used the Arduino Timer intterupt.
A DS3231 RTC is more accurate and can generate a 1Hz, 1kHz, 4kHz or 8kHz interrupt.

Pete
37  Using Arduino / Programming Questions / Re: Time difference of 6 hours? on: August 09, 2014, 02:37:37 pm
The sketch also works for me and I see no difference between the two times at all.
The apparent one second difference is only due to the way that the two times are printed:
Quote
19:30:11 // from ReadDS3231

19:30:11 // from Clock.getTime
19:30:12 // from ReadDS3231

19:30:12 // from Clock.getTime
19:30:13 // etc.

19:30:13
19:30:14

19:30:14
19:30:15
Clock.getTime is printed immediately after ReadDS3231 but they are separated by a blank line which makes it look like the times are one second apart but in fact this pair:
Quote
19:30:11 // from ReadDS3231

19:30:11 // from Clock.getTime
are printed in the same one second interval, and similarly for the other pairs.
The code should be fixed so that the blank line is printed between a ReadDS3231/Clock.getTime pair.

Pete
38  Community / Bar Sport / Re: Solder/Sodder on: August 09, 2014, 10:22:43 am
salmon?
calm.
At least, the 'L' is silent the way I pronounce them.

Pete
39  Using Arduino / Programming Questions / Re: Getting a float division from integers on: August 09, 2014, 10:14:16 am
There are other ways but this will do it.
Code:
test = (4194304./(r+(65536.*oflow)));

Pete
40  Using Arduino / Audio / Re: FFT with DUE and TFT on: August 07, 2014, 02:49:22 pm
Were the FFT libraries you tried specifically written to run on the DUE? If not, there may be problems with the different size of 'int' on the DUE (32 bits) and on earlier Arduinos (16 bits). You could try changing all occurrences of 'int' in the library to 'int16_t' and any occurrence of 'unsigned int' to 'uint16_t'.

Pete
41  Using Arduino / Programming Questions / Re: Arc cosine function not functioning as expected. what am i missing? on: August 07, 2014, 12:00:32 pm
Quote
The values (that you input to acos()) are in degrees. They need to be in radians.
The output of the acos function is in radians. The input is a number from -1 to +1.

Pete
42  Using Arduino / Programming Questions / Re: Serial port communication keeps disconnecting for unknown reason on: August 07, 2014, 11:07:08 am
Maybe one or more of the Arduinos has run out of ram and crashed.

Pete
43  Community / Website and Forum / Re: Too much spam ! on: August 04, 2014, 11:00:04 am
Quote
The word is actually "trustee".
Nope, I used it in the sense of a trusty in prison.

Pete
44  Using Arduino / Programming Questions / Re: Unknown Error Messages on: August 03, 2014, 09:01:53 pm
BTW. There are two things that I know of that will drive the IDE/java insane in that way. One is the unmatched quote.
The other is the unterminated block comment - i.e. if you have /* but the */ is missing.

Pete
45  Using Arduino / Programming Questions / Re: Unknown Error Messages on: August 03, 2014, 08:25:55 pm
Code:
   Serial.print("RAP - ");"
The extraneous quote at the end of this line will drive the IDE crazy!

You are also missing one } near the end of the loop() function.

Pete
Pages: 1 2 [3] 4 5 ... 110