Loading...
Pages: 1 ... 5 6 [7]   Go Down
Author Topic: Newbi need some help please  (Read 1897 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 143
Posts: 19370
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but the use milis, why did i get a RTC then?
"millis" tells you the time that has elapsed since the last reset.
An RTC should retain the time even if the processor is reset or powered-off.
"millis" and "micros" also give you the time in smaller increments than most RTCs.
Logged

Pete, it's a fool looks for logic in the chambers of the human heart.

South Africa
Offline Offline
Newbie
*
Karma: 0
Posts: 47
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I Know HazardsMind it was aimed at AWOL
You been helping a lot thank you
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 143
Posts: 19370
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
it was aimed at AWOL
OK, bye.
Logged

Pete, it's a fool looks for logic in the chambers of the human heart.

South Africa
Offline Offline
Newbie
*
Karma: 0
Posts: 47
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

AWOL i am a pc Tech and the obvious things for me is not so obvious for the public i work with, sometimes i cant understand why they don't understand things that is second nature to me. So i know why you getting fed up with me asking so much, i don't understand the obvious to you, hence the questions.
I felt today like the ppl that come to me for advice, there is no excuse for my behavior.
I am sorry for shouting at you
Logged

South Africa
Offline Offline
Newbie
*
Karma: 0
Posts: 47
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For ppl that is interested in te code to control a pin with a RTC here is the code. The pin(in this case smiley-cool will be high for the ten secs the if statement is true. After ten secs the pin will go low

Code:
#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 RTC;
int ledPin = 8;

void setup()   
{
  Serial.begin(9600); 
  Wire.begin();       
  RTC.begin();       

 
  RTC.adjust(DateTime(__DATE__, __TIME__));
  pinMode (ledPin, OUTPUT);
}

void loop()   
{
  DateTime now = RTC.now(); 
  Serial.print(" Time = ");
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');
  Serial.print(now.second(), DEC);
  Serial.println();
  delay(3000);
  if (now.hour() == 20 && now.minute() == 56 && now.second() < 10)
      digitalWrite(ledPin, HIGH);   
  else {
    digitalWrite(ledPin, LOW);
 }
}
Logged

Queens, New York
Online Online
Edison Member
*
Karma: 31
Posts: 1733
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You still need to take out "delay(3000);" , its not needed. Also now.second() < 10, is not for ANY 10 seconds, but for when the clock changes from say (example) 5 minutes to 6 minutes. The LED is only ON for the first 10 seconds, of the NEW minute. Actually it would be 7 seconds, since you have that 3 second delay still in there.

Just pointing that out.
Logged

UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W

"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown

South Africa
Offline Offline
Newbie
*
Karma: 0
Posts: 47
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Tx HazardsMind
My objective with this was so that when i get my motor shield i will adapt the code to activate a dc motor at say 8am in and run it for ten seconds, then it will stop. Thant will be the time it takes from a closed blind to open them.
Logged

Queens, New York
Online Online
Edison Member
*
Karma: 31
Posts: 1733
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, if it works,it works.
Logged

UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W

"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown

Pages: 1 ... 5 6 [7]   Go Up
Print
 
Jump to: