My workout clock, timer... thing..

Hey I'm trying slowly but surely learn electronics and programming.
Electricity bit goes a little better and programming is quite difficult for me.

I am about to build a helper for myself when I practice, the last reps out off my training is so tough so I find it difficult to find the right gear. it is only 5 sec rest between each rep so i becomes easy giddy when pumped after 45 minutes. (60 min is the workout).
Therefore, the light and sound is going to help me.

I am using an Arduino, and 4x Tlc5940 RGB controllers to control 21 different RGB leds.
They are hooked up and running it's just the hard programming remains ..
I do not want anybody to help me and write the entire code for this project but help me with a little bit so that I can get it together in the end. by my self..
I will make new projects after this course :).

this is not my code but I wrote down a "run schema" in notepad that I have as a template for the code. it says everything I want to do, except that I forgot.. and that I dare not implement in the beginning because it will be too heavy for me. (in the future i want to have a small OLED screen with with the time on :slight_smile: ).

this schedule is shortened so it contains only the first 2 steps but then continues only, then there will be a 10 minutes long rest. This should be done three times since the training is completed. whohoo! :slight_smile:

// RGB led 1 and 2
// 10 sec Countdown
// RGB led 1-2 counts down blinking yellow and green
// buzzer beeps 3 times for the last 3 seconds

led 1-2 ON 		5 sec // buzzer beeps, leds turns green
Leds OFF 			5 sec // leds turns blinking red for 1 sec, yellow for 1 sec.
led 1-2 ON 		7 sec // and so on..
Leds OFF 			5 sec
led 1-2 ON 		9 sec
Leds OFF 			5 sec
led 1-2 ON 		11 sec 
Leds OFF 			5 sec
led 1-2 ON 		9 sec
Leds OFF 			5 sec
led 1-2 ON 		7 sec
Leds OFF 			5 sec
led 1-2 ON 		5 sec
Leds OFF 			60 sec

// next leds starts blinking led 2 and 3, 1 sec red 1 sec yellow.
// after 40 sec buzzer beeps one time.
// after 50 sec beeps one time. (starting 10 sec countdown sequence)
// last 3 sec beeps once per second.

RGB led 2 and 3
Countdown 		10 sec

Led 2-3 ON 		5 sec
Leds OFF 			5 sec
Led 2-3 ON 		7 sec
Leds OFF 			5 sec
Led 2-3 ON 		9 sec
Leds OFF 			5 sec
Led 2-3 ON 		11 sec
Leds OFF 			5 sec
Led 2-3 ON 		9 sec
Leds OFF 			5 sec
Led 2-3 ON 		7 sec
Leds OFF 			5 sec
Led 2-3 ON 		5 sec

Leds OFF 			10 min

// start at the beginning.
// do this 3 times. then finished

This is my code, it works but i think it's not going to work in the long run.
I know that it is not possible for the schedule above but I have tested me out with this code to see how I should go about. buzzer is not yet in this code but I see it as secondary right now. but you'll have an idea of what level my knowledge is on :slight_smile:

#include "Tlc5940.h"

int one = 1-3; 
void setup() {
  // put your setup code here, to run once:

Tlc.init();

}

void loop() {
  // put your main code here, to run repeatedly:
 
Tlc.update(); 
Tlc.set(1, 2500); // Orenge
Tlc.set(2, 3000);
Tlc.set(3, 000);

Tlc.set(4, 2500); // Orenge
Tlc.set(5, 3000);
Tlc.set(6, 000);

delay (1000);
Tlc.update();
Tlc.clear();
Tlc.set(1, 000); // clear
Tlc.set(2, 000);
Tlc.set(3, 000);

Tlc.set(4, 000); // clear
Tlc.set(5, 000);
Tlc.set(6, 000);

delay (1000);
Tlc.update();
Tlc.clear();Tlc.update(); 
Tlc.set(1, 2500); // Orange
Tlc.set(2, 3000);
Tlc.set(3, 000);

Tlc.set(4, 2500); // Orange
Tlc.set(5, 3000);
Tlc.set(6, 000);

delay (1000);
Tlc.update();
Tlc.clear();
Tlc.set(1, 000); // black
Tlc.set(2, 000);
Tlc.set(3, 000);

Tlc.set(4, 000); // clear
Tlc.set(5, 000);
Tlc.set(6, 000);

delay (1000);
Tlc.update();
Tlc.clear();

Tlc.set(1, 000); // green
Tlc.set(2, 4000);
Tlc.set(3, 000);

Tlc.set(4, 000); // green
Tlc.set(5, 4000);
Tlc.set(6, 000);

delay (5000);
Tlc.update();
Tlc.clear();

Tlc.set(1, 000); // clear
Tlc.set(2, 000);
Tlc.set(3, 000);

Tlc.set(4, 000); // clear
Tlc.set(5, 000);
Tlc.set(6, 000);

delay (1000);
Tlc.update();
Tlc.clear();

}

Question
1, do i need a RTC clock for this?
2, how to shorten down the code for each RGB led? if i use int i cant give 3 channels different values?
3, how to shorten down each segment of the code.

Live long ! :slight_smile: