Newbi need some help please

I'll ask again. What is the while loop for?

kimbo001: Hi Peter

I know it can be done with some commercial thing, but like i stated in the OP am disabled and have allot of time and this subject interest me allot, apart from that i don't really have the finances to just go out and buy.

BTW is there some newbie friendly tutorial that show how to control DC motors with a timer? I just need the syntax for .. if time is xxx then set pin y to HIGH But all i get is ppl making a alarm clock or something weird

That's perfectly fine and reasonable - I just wanted to check that you weren't missing an easier solution.

An alarm clock is the most obvious thing to do with a real-time clock and it doesn't surprise me that it turns up a lot in your search results.

The functionality you need to work out what the current time is, is obviously the same whether your are implementing an alarm clock to sound a buzzer or a controller to turn a motor on at a particular time. In either case, you would need to read the time from the RTC and extract just the time within the current day (i.e. time since midnight), then compare that with some configured values that you have saved to record when the curtains should be opened or closed. In my view this also implies some facility to display and change the RTC time, and to display and change the configured times for opening and closing curtains etc. You will also need to save the configured times somewhere, and I would have thought that the integral EEPROM was the most sensible place to store them. Finally, you probably want it to display the current time and what state it thinks the curtains (etc) are intended to be in.


It doesn't need to be in a while loop, but I was talking about nested loops before, so I continued using the while loop.

he could easily do,

digitalWrite(motorForPin, HIGH); delay(20*1000); digitalWrite(motorForPin,LOW);

and it will work exactly the same.

@Peter Thanks I will look for the most simple alarm clock triggering an alarm and work from there.

@HazardsMind I wanted to do it like that with a light sensor but i ran into some trouble, i want to include a manuel toggle switch but if the blinds close during the day the light sensor will freak and open the blinds again so AWOL suggested two light sensors or a RTC, i opted for the RTC but to get sample code for a DC motor controlled via RTC is rather difficult.

Did you look at this already? NOTE: it is quite overwhelming, and I agree with Peter after looking at this, to look for a simple alarm clock code.

Been there tx. I am looking for that elusive simple alarm clock now :)

Seems like Google came to the resque:


Precondition: The alarm time has been stored in h (hour) and m (minute).

uint8_t h, m;

Then the following if condition will be true for one minute:

if ( RTC.hour == h && RTC.minute == m ) doAlarmSound();

Hi I got my ardiuno yesterday and was playing with it. Today my LED one color strip came so i just want to pls ask how do i connect it with an external power supply to the ardiuno? I know the grd from the ardiuno and the grd from the power supply must go together but i have no idea were to from there. Google just give me RGB strips with more than two wires but my strip just have two wires. I did the blink project successfully but now i want to connect the strip so that they can blink. Please help me

Did the LED strip come with any documents, wiring schematics, anything like that. Does it say what input voltage it needs to operate, anywhere on it? Do you have a link to what kind of LED strip your using?

The 30cm one

Ok it operates at 12V, but it does not say anything about current. Try to get a 12V power supply and see if it lights up. I don't think you will be able to trun individual LEDs on and off though.

yes i have a power supply and it lights up when i connect the negative and positive. No i am not attempting to light individual LED's i just want the whole strip to blink.

A photoresistor (cds cell) is another option, though it seems you have already chosen to go with an RTC. If the exact time of day is not important, simply when the sun rises/sets, using photo sensor would be much cheaper and easier to trigger the action.

Tx, For now i just want them to blink so that i know how to connect them to the ardiuno, lets say just to get my feet wet :)

Do you have a meter that you can use to measure the current load. I didn't see a current rating in the listing. But in any case, you will need a transistor to switch the LED strip.

Oh, then you need a transistor to be activated by the arduino. You might want to invert the driving transistor with a second transistor, so that when the output pin is HIGH, the LEDs are on.

This is not exactly what I want to show you but, i'm at work and i'm limited to what images I can view.

Thank you Can i use the same transistor for a 5m LED strip (one color)?

Can i use the same transistor for a 5m LED strip (one color)?

Possibly, You must check the current rating for the LED strip and compare it to the datasheet for the transistor.

2N3904 is only rated for 200mA, so I would bet- No, not gonna work out well for the transistor. But without knowing the specifics, I couldn't say for sure.

HazardsMind seanz2003 Thank you for your help, just a last question: Can you please explain in as newbi language that diagram for me please. I understand bout the 1k and 10k resisters, i am still not sure what side goes to the arduino and what side goes to the supply. Sorry for the very basic question, i am in the deep end and trying to learn

Edit: looks to be 2A current for 5m