PIR + Photocell + Nano/uno + mosfet = leds fade in/out = how???

hello masters,

please give a hand to this newbie and tell me how to built this project.
I have searched all the web but could not find an answer for a long time...

PROJECT IS;
at night (photocell) when motion detected (PIR) arduino should fade in leds via mosfet. ( when there is no motion leds should dim/fade out gradually)

can you spare max 30sec to copy and paste a source to do this project?

your help will be very very much apreciated...

Thank you !
Sami

There are many experienced Arduino programmers here, but even they could not write new code for your exact project in 30s, even if they wanted to.

You need to show you are willing to learn and put a little effort in!

Break down the problem and treat each part of the project as a separate mini-project. Perhaps start with just reading the photocell (ldr?) and echoing the value back to the pc. Then maybe the pir sensor. Then fading a small led connected directly to the arduino output, and so on.

Paul

Is Google broken where you are?

i have searched all the google and watched every single youtube video related...

is it that difficult to copy and paste something related to this?

were you born electronic expert? did not anybody helped you ever? ...

Examples of all the software components required are to be found as part of the Arduino IDE.
If you show some effort towards reaching your goal, I'm sure people will help you.
(It took me almost 30 seconds just to type this post).

Thank you Awol! At least someone leads me to do things correct…

i have found and modified this code, any help improving this code is apreciated.

// led pins
int redPin   = 11;
//
// photo resistor pin
int photoPin = A0;
//
int lightLevel = 0;
int minLight, maxLight;
// pyro pin
int piroPin  = 2;
//
int pirState = LOW;

void setup()
{
  pinMode ( redPin,   OUTPUT );
  lightLevel = analogRead ( photoPin );
  minLight = lightLevel - 20;
  maxLight = lightLevel;

  pinMode ( piroPin,  INPUT );
}

void loop()
{
  int nigthMode = nightMode ();

  if ( nigthMode == 0 ) powerOn ( LOW );
  else
  {
    int motionDetected = motion ();
    powerOn ( nigthMode && motionDetected );
  }

  delay ( 1000 );
}

void powerOn ( int off )
{
  if ( off == LOW )
  {
    analogWrite ( redPin,   0 );
  }
  else fade();
}

int nightMode ()
{
  lightLevel = analogRead ( photoPin );
  if ( minLight > lightLevel ) minLight = lightLevel;
  if ( maxLight < lightLevel ) maxLight = lightLevel;

  int med = map ( lightLevel, minLight, maxLight, 0, 100 );
  return med < 20;
}
int motion()
{
  int ret = 0;
  int val = digitalRead ( piroPin );

  if ( val == HIGH ) {
    ret = 1;
    if ( pirState == LOW ) pirState = HIGH;
  } 
  else {
    ret = 0;
    if ( pirState == HIGH ) pirState = LOW;
  }

  return ret;
}
void fade()
{
  for ( int i = 0 ; i < 255 ; i += 1 )
  {

  }
}