#include <TM1637.h>
const int CLK = 2;
const int DIO = 3;
TM1637 tm(CLK, DIO);
int redPin = 9;
int greenPin = 11;
int bluePin = 10;
void setup() {
// put your setup code here, to run once:
tm.init();
tm.set(BRIGHT_TYPICAL);
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
unsigned int counter = 0;
void loop() {
// put your main code here, to run repeatedly:
tm.display(0, (counter / 1000) % 10);
tm.display(1, (counter / 100) % 10);
tm.display(2, (counter / 10) % 10);
tm.display(3, counter % 10);
counter++;
if (counter == 1000) {
counter = 0;
}
delay(100);
if (counter >10 && counter<100){
analogWrite(redPin,255);
analogWrite(greenPin,0);
analogWrite(bluePin,0);
}
else if (counter >100 && counter<200){
analogWrite(redPin,0);
analogWrite(greenPin,255);
analogWrite(bluePin,0);
}
else if (counter >200 && counter<300){
analogWrite(redPin,0);
analogWrite(greenPin,0);
analogWrite(bluePin,255);
}
else if (counter >300 && counter<400){
analogWrite(redPin,255);
analogWrite(greenPin,255);
analogWrite(bluePin,255);
}
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
sevseg1:CLK
sevseg1:DIO
sevseg1:VCC
sevseg1:GND
rgb1:R
rgb1:COM
rgb1:G
rgb1:B