Arduino Clock with LDR . PWM intensity control question

Discussion in 'General Electronics Chat' started by chrischrischris, Mar 14, 2015.

  1. chrischrischris

    Thread Starter Member

    Feb 18, 2012
    283
    10
    Hi, can someone please help me with some code for an Arduino circuit.
    I've written a program to run a mm:ss timer with pause/start and reset. I've multiplexed the 4 x 7 segment displays. I've also created another circuit to test controlling the intensity of a single LED via an LDR. I'm now trying to merge the 2 but having difficulty.

    Below is a part example of the code where I tried to change it, but it isn't working:

    digitalWrite(commons [0],HIGH);
    previousMillis=currentMillis;
    sevenSegWrite_1(sec_ones);
    digitalWrite(commons [3],LOW);
    with
    analogWrite(commons [0],value);
    previousMillis=currentMillis;
    sevenSegWrite_1(sec_ones);
    analogWrite(commons [3],value);

    (Please find the whole file attached - renamed to .txt from .ino as I didn't know how else to upload it)
     
  2. chrischrischris

    Thread Starter Member

    Feb 18, 2012
    283
    10
    Please ignore this post as I've worked out the problem.
     
Loading...