Show Posts
Pages: 1 ... 7 8 [9] 10 11 ... 23
121  Using Arduino / Programming Questions / Re: DS1307 RTClib on: June 25, 2013, 12:09:26 am
That's alright. Using array can reduce your code maybe by 90% from using switch cases. Unless you will be doing some very different things for each case, you can use array's index in place of switch cases. On the other hand, if you later decide that every Monday is "holy" and needs to be called holyday and hail "lord ardin" then you have to give up the array method and get back to your switch cases. It all depends on situation.
Yup! Get it !

Anyway, I am now trying to make alarm based on this rtclib. Any ideas ? Am still trying smiley
122  Using Arduino / Programming Questions / Re: DS1307 RTClib on: June 24, 2013, 11:45:41 pm
Thanks !

It is just because my array basic is not strong. So I misunderstand about that.

Appreciate your help ! smiley
123  Using Arduino / Programming Questions / Re: DS1307 RTClib on: June 24, 2013, 11:19:02 pm
So if DOW[1][4], it will display MON ?
124  Using Arduino / Programming Questions / Re: DS1307 RTClib on: June 24, 2013, 11:00:38 pm
You can do:

Code:
char DOW[][4]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
lcd.print(DOW[now.dayOfWeek()]);

Quick and easy. BTW, the DOW could be either starting with Sunday or Monday so you may need to change some orders.
Hey, I do not understand your coding. Why you put
Code:
char DOW[][4]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
lcd.print(DOW[now.dayOfWeek()]);
char DOW[][4] ? What is the 4 for ?

Thanks
125  Using Arduino / Programming Questions / Re: DS1307 RTClib on: June 24, 2013, 10:58:00 pm
You can do:

Code:
char DOW[][4]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
lcd.print(DOW[now.dayOfWeek()]);

Quick and easy. BTW, the DOW could be either starting with Sunday or Monday so you may need to change some orders.
I do like this :
Code:
lcd.setCursor(0, 3);
   int dayofweek = now.dayOfWeek();
   switch(dayofweek){
     case 1:
     lcd.print("Monday");
     break;
     case 2:
     lcd.print("Tuesday");
     break;
     case 3:
     lcd.print("Wednesday");
     break;
     case 4:
     lcd.print("Thursday");
     break;
     case 5:
     lcd.print("Friday");
     break;
     case 6:
     lcd.print("Saturday");
     break;
     case 7:
     lcd.print("Sunday");
     break;
    delay(1000);
}
Think it is ok too smiley
126  Using Arduino / Programming Questions / Re: DS1307 RTClib on: June 24, 2013, 10:39:56 pm
I believe the OP wants a solution using the RTClib, not the library-less direct access. Take a look here:

Code:
class DateTime {
public:
    DateTime (uint32_t t =0);
    DateTime (uint16_t year, uint8_t month, uint8_t day,
                uint8_t hour =0, uint8_t min =0, uint8_t sec =0);
    DateTime (const char* date, const char* time);
    uint16_t year() const       { return 2000 + yOff; }
    uint8_t month() const       { return m; }
    uint8_t day() const         { return d; }
    uint8_t hour() const        { return hh; }
    uint8_t minute() const      { return mm; }
    uint8_t second() const      { return ss; }
    uint8_t dayOfWeek() const;

    // 32-bit times as seconds since 1/1/2000
    long secondstime() const;  
    // 32-bit times as seconds since 1/1/1970
    uint32_t unixtime(void) const;

protected:
    uint8_t yOff, m, d, hh, mm, ss;
};


Since you can do all the date and time already, you should understand this:

Code:
DateTime now;
now=RTC.now();
dayofweek=now.dayOfWeek();
lcd.print(now.dayOfWeek(), x);
what should be the x so that it print words like Tuesday ?
Ok, maybe for dayofweek dont have such thing. I think I have to make case structure for this. Cause now.dayofweek() will return only int. So I have to do case structure. Am I right ?

Thanks
127  Using Arduino / Programming Questions / DS1307 RTClib on: June 24, 2013, 12:05:21 pm
Dear all,

I have started to play around with ds1307 IC and I am using the rtclib from adafruit.
I can get seconds, minutes, hours and date.

Am I able to obtain the day too ? For eg Monday, Tuesday , wednesday ?

Thanks !
128  Using Arduino / Project Guidance / Re: L293D motor driver on: June 23, 2013, 11:29:15 am
Opps, it suppose to be the input pins. Sorry I get it wrongly. The output pins is connected to motor

Thanks
129  Using Arduino / Project Guidance / Re: L293D motor driver on: June 23, 2013, 11:00:42 am
Oh, do I need to deal with the enable pin in the IC or just the output pins of the IC ?
130  Using Arduino / Project Guidance / Re: L293D motor driver on: June 23, 2013, 10:55:51 am
Then how I interface/program it ?

Thanks
131  Using Arduino / Project Guidance / L293D motor driver on: June 23, 2013, 10:50:12 am
Hey all,

Recently I have tried to interfacee DC motor using L293D motor driver. It works fine for me in controlling the motor in either clockwise/anticlockwise at a constant speed.

However, I would like to ask if how am I able to change the speed ? Liek maybe I want it to change at right at full speed and half speed ? Can I do that with arduino UNO ?

Thanks !
132  Using Arduino / Installation & Troubleshooting / Re: DIY Arduino problem on: February 06, 2013, 09:33:42 pm
Yea, so I neeed a pull up resistor smiley-grin

Thanks ^^
133  Using Arduino / Installation & Troubleshooting / Re: DIY Arduino problem on: February 06, 2013, 09:55:38 am
So, the minimum circuit for an arduino based development board is a 16MHz crystal and the 100nF cap for power supply and pull up resistor for RESET pin ?

No, you can use the internal oscilator (there is a fuse). And the reset is not required. The minimum is just the cap for the supply

Why reset is not required ? I thought RESET should be pulled up for normal usage ?

Thanks smiley-grin
134  Using Arduino / Microcontrollers / Re: Attiny 85 on: February 06, 2013, 08:40:49 am
USBasp consider HVP ? Oh, so for normal usage, I onyl can use 5 pins ?

Thanks
135  Using Arduino / Microcontrollers / Attiny 85 on: February 06, 2013, 08:35:01 am
Dear friend,

recently I get myself some attiny85. So, by referring to the datasheet, it mention it has 6 programmable I/O. But I just only can see there are 5 programmable IO only. Is it that the RESET pins also can be the IO  ?

Thanks
Pages: 1 ... 7 8 [9] 10 11 ... 23