Hi.
I’m a bit new to Arduino and have a question on a project I’m doing. I created a project out of discrete components and now am trying to replicate it to code so that I can have more flexibility and simplify the electronics.
I’ve written code for a minute/second timer (mm:ss) via 4 off 7 segment displays. To minimize outputs, I’ve multiplexed the displays. Seems to work ok so far. I’m now trying to incorporate an LDR in the circuitry to control the intensity (darker at night and lighter during the day).
I’ve tried reading the LDR signal and feeding it to the commons in the mutiplex. Doesn’t work properly. Is this because I’m using CC digits? Should they instead by CA? If so, in the short term, is there an easy way of re-coding to use my CC digits. Attached is the code. Part of the code (that I tried to alter) is as follows:
if(stepMultiplex == 1 && (currentMillis - previousMillis) >= delayMp) {
digitalWrite(commons [0],B);
previousMillis=currentMillis;
sevenSegWrite_1(sec_ones);
digitalWrite(commons [3],A);
stepMultiplex=2;
Tried to change to:
if(stepMultiplex == 1 && (currentMillis - previousMillis) >= delayMp) {
digitalWrite(commons [0],B);
previousMillis=currentMillis;
sevenSegWrite_1(sec_ones);
digitalWrite(commons [3],dValue); // where dValue is the mapped analog value from the LDR
stepMultiplex=2;
_02_2015_02_23_clock_d.ino (7.58 KB)