Hi. I want to use 2 multiplexed seven segment displays to display a count from 00 to 99 repeatedly using loops..how can i code my arduino to do so?
Hi,
Welcome to the forum.
Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html
Do you want your code to do the multiplexing, or are you going to use two x 2 digit multiplexed displays?
Have you got the displays, if so can you tell us what your have?
What model Arduino do you have.
How are you going to advance the count, buttons, sensors?
Can you tell us your electronics, programming, Arduino, hardware experience?
Thanks.. Tom..
Hello tom, i am using arduino uno...i want to write a cc program to 2 multiplexed seven segment display to start counting from 00 to 99 like digital clock
You can use this library turns your Arduino into a seven segment display controller!
https://playground.arduino.cc/Main/SevenSegmentLibrary
/* SevSeg Counter Example
Copyright 2017 Dean Reading
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This example demonstrates a very simple use of the SevSeg library with a 4
digit display. It displays a counter that counts up, showing deci-seconds.
*/
#include "SevSeg.h"
SevSeg sevseg; //Instantiate a seven segment controller object
void setup() {
byte numDigits = 2;
byte digitPins[] = {2, 3};
byte segmentPins[] = {6, 7, 8, 9, 10, 11, 12, 13};
bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
byte hardwareConfig = COMMON_ANODE; // See README.md for options
bool updateWithDelays = false; // Default. Recommended
bool leadingZeros = false; // Use 'true' if you'd like to keep the leading zeros
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments, updateWithDelays, leadingZeros);
sevseg.setBrightness(90);
}
void loop() {
static unsigned long timer = millis();
static int Seconds = 0;
if (millis() - timer >= 1000) {
timer += 1000;
Seconds++; // 1000 milliSeconds is equal to 1 Second
if (Seconds == 100) { // Reset to 0 after counting for 100 seconds.
Seconds=0;
}
sevseg.setNumber(Seconds, 1);
}
sevseg.refreshDisplay(); // Must run repeatedly
}
/// END ///