- initialize repo
- add 3D STL files - add firmware
This commit is contained in:
parent
cccfb2c3c7
commit
150e31dfe7
BIN
CAD/BasePlate1.stl
Normal file
BIN
CAD/BasePlate1.stl
Normal file
Binary file not shown.
BIN
CAD/BasePlate2.stl
Normal file
BIN
CAD/BasePlate2.stl
Normal file
Binary file not shown.
BIN
CAD/FrameCornerButtons.stl
Normal file
BIN
CAD/FrameCornerButtons.stl
Normal file
Binary file not shown.
BIN
CAD/FrameLong.stl
Normal file
BIN
CAD/FrameLong.stl
Normal file
Binary file not shown.
BIN
CAD/FrameShort.stl
Normal file
BIN
CAD/FrameShort.stl
Normal file
Binary file not shown.
BIN
CAD/LightGuide1.stl
Normal file
BIN
CAD/LightGuide1.stl
Normal file
Binary file not shown.
BIN
CAD/LightGuide2.stl
Normal file
BIN
CAD/LightGuide2.stl
Normal file
Binary file not shown.
BIN
CAD/LightGuide3.stl
Normal file
BIN
CAD/LightGuide3.stl
Normal file
Binary file not shown.
BIN
CAD/frameCorner.stl
Normal file
BIN
CAD/frameCorner.stl
Normal file
Binary file not shown.
260
Firmware/periodic.ino
Normal file
260
Firmware/periodic.ino
Normal file
@ -0,0 +1,260 @@
|
|||||||
|
#include <FastLED.h>
|
||||||
|
#include <Wire.h>
|
||||||
|
#include "RTClib.h"
|
||||||
|
RTC_DS1307 RTC;
|
||||||
|
|
||||||
|
//replace this value with the number of LEDS on your strip
|
||||||
|
#define NUM_LEDS 60
|
||||||
|
#define DATA_PIN 3
|
||||||
|
#define CLOCK_PIN 13
|
||||||
|
|
||||||
|
//Define colors for hours, minutes and seconds.
|
||||||
|
//you can also define custom RGB colors like this: CRGB( 255, 255, 255);
|
||||||
|
#define hourColor CRGB::Blue;
|
||||||
|
#define minuteColor CRGB::Green;
|
||||||
|
#define secondColor CRGB::Red;
|
||||||
|
|
||||||
|
//Define overlapping colors
|
||||||
|
#define HMoverlap CRGB::Cyan;
|
||||||
|
#define MSoverlap CRGB::Yellow;
|
||||||
|
#define SHoverlap CRGB::Purple;
|
||||||
|
|
||||||
|
unsigned long actTime = 0;
|
||||||
|
unsigned long remTime = 0;
|
||||||
|
const unsigned long period = 500;
|
||||||
|
bool blinkState = false;
|
||||||
|
bool menuTriggered = false;
|
||||||
|
bool toggleSeconds = true;
|
||||||
|
int BRIGHTNESS = 51;
|
||||||
|
const int menuButton = 8;
|
||||||
|
const int upButton = 6;
|
||||||
|
const int downButton = 4;
|
||||||
|
boolean buttonPrev = false;
|
||||||
|
boolean buttonPrev2 = false;
|
||||||
|
boolean buttonPrev3 = false;
|
||||||
|
|
||||||
|
int menuState = 0;
|
||||||
|
// Define the array of leds
|
||||||
|
CRGB leds[NUM_LEDS];
|
||||||
|
int periodic[NUM_LEDS] {0,58,59,57,56,55,54,53,52,51,50,42,43,44,45,46,47,48,49,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,5,4,3,2,1};
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
Wire.begin();
|
||||||
|
RTC.begin();
|
||||||
|
//uncomment the following line when you first upload the code to set the time
|
||||||
|
//RTC.adjust(DateTime(__DATE__, __TIME__));
|
||||||
|
//you an also use the following line to set a custom time
|
||||||
|
//RTC.adjust(DateTime(2022, 2, 24, 14, 20, 0));
|
||||||
|
pinMode(menuButton, INPUT);
|
||||||
|
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS); // GRB ordering is typical
|
||||||
|
FastLED.setBrightness(BRIGHTNESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
|
||||||
|
menuButtonState();
|
||||||
|
|
||||||
|
if(menuState==0){
|
||||||
|
if((digitalRead(upButton) && buttonPrev2)){
|
||||||
|
if(toggleSeconds){
|
||||||
|
toggleSeconds=false;
|
||||||
|
}else{toggleSeconds=true;}
|
||||||
|
Serial.println(toggleSeconds);
|
||||||
|
}
|
||||||
|
buttonPrev2 = !digitalRead(upButton);
|
||||||
|
//increase brightness in increments
|
||||||
|
if((digitalRead(downButton) && buttonPrev3)){
|
||||||
|
if (BRIGHTNESS <255){
|
||||||
|
BRIGHTNESS = BRIGHTNESS + 51;
|
||||||
|
}else{
|
||||||
|
BRIGHTNESS = 51;
|
||||||
|
}
|
||||||
|
FastLED.setBrightness(BRIGHTNESS);
|
||||||
|
Serial.print("Brightness set to: ");
|
||||||
|
Serial.println(BRIGHTNESS);
|
||||||
|
}
|
||||||
|
buttonPrev3 = !digitalRead(downButton);
|
||||||
|
FastLED.clear();
|
||||||
|
|
||||||
|
showTime();
|
||||||
|
}else if(menuState==1){
|
||||||
|
setMinute();
|
||||||
|
}else if(menuState==2){
|
||||||
|
setHour();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void showTime(){
|
||||||
|
unsigned long currentMillis = millis();
|
||||||
|
DateTime now = RTC.now();
|
||||||
|
if((now.second()==now.minute()) && toggleSeconds){
|
||||||
|
leds[periodic[now.second()]] = MSoverlap;
|
||||||
|
leds[periodic[now.hour()]] = hourColor;
|
||||||
|
}else if((now.second()==now.hour()) && toggleSeconds){
|
||||||
|
leds[periodic[now.second()]] = SHoverlap;
|
||||||
|
leds[periodic[now.minute()]] = minuteColor;
|
||||||
|
}else if(now.minute()==now.hour()){
|
||||||
|
if(toggleSeconds){leds[periodic[now.second()]] = secondColor;}
|
||||||
|
leds[periodic[now.minute()]] = HMoverlap
|
||||||
|
}else{
|
||||||
|
if(toggleSeconds){leds[periodic[now.second()]] = secondColor;}
|
||||||
|
leds[periodic[now.minute()]] = minuteColor;
|
||||||
|
leds[periodic[now.hour()]] = hourColor;
|
||||||
|
}
|
||||||
|
FastLED.show();
|
||||||
|
leds[periodic[now.second()]] = CRGB::Black;
|
||||||
|
leds[periodic[now.minute()]] = CRGB::Black;
|
||||||
|
leds[periodic[now.hour()]] = CRGB::Black;
|
||||||
|
}
|
||||||
|
|
||||||
|
void menuButtonState() {
|
||||||
|
if(digitalRead(menuButton) && buttonPrev){
|
||||||
|
menuTriggered = false;
|
||||||
|
if(menuState<2){
|
||||||
|
menuState = menuState + 1;
|
||||||
|
}else{
|
||||||
|
menuState = 0;
|
||||||
|
}
|
||||||
|
Serial.println(menuState);
|
||||||
|
}
|
||||||
|
buttonPrev = !digitalRead(menuButton);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void setMinute() {
|
||||||
|
|
||||||
|
// FastLED.clear();
|
||||||
|
actTime = millis();
|
||||||
|
DateTime now = RTC.now();
|
||||||
|
RTC.adjust(DateTime(now.year(), now.month(), now.day(), now.hour(), now.minute(), 1));
|
||||||
|
|
||||||
|
if(digitalRead(upButton) && buttonPrev2){
|
||||||
|
leds[periodic[now.minute()]] = CRGB::Black;
|
||||||
|
RTC.adjust(DateTime(now.year(), now.month(), now.day(), now.hour(), now.minute()+1, now.second()));
|
||||||
|
}else if(digitalRead(downButton) && buttonPrev3){
|
||||||
|
leds[periodic[now.minute()]] = CRGB::Black;
|
||||||
|
RTC.adjust(DateTime(now.year(), now.month(), now.day(), now.hour(), now.minute()-1, now.second()));
|
||||||
|
}
|
||||||
|
buttonPrev2 = !digitalRead(upButton);
|
||||||
|
buttonPrev3 = !digitalRead(downButton);
|
||||||
|
|
||||||
|
if (actTime - remTime >= period){
|
||||||
|
remTime = actTime;
|
||||||
|
if(!blinkState) {
|
||||||
|
blinkState = true;
|
||||||
|
Serial.print(now.hour(), DEC);
|
||||||
|
Serial.print(':');
|
||||||
|
Serial.print(now.minute(), DEC);
|
||||||
|
Serial.print(':');
|
||||||
|
Serial.print(now.second(), DEC);
|
||||||
|
Serial.println();
|
||||||
|
if(now.second()==now.minute()){
|
||||||
|
leds[periodic[now.second()]] = MSoverlap;
|
||||||
|
leds[periodic[now.hour()]] = hourColor;
|
||||||
|
}else if(now.second()==now.hour()){
|
||||||
|
leds[periodic[now.second()]] = SHoverlap;
|
||||||
|
leds[periodic[now.minute()]] = minuteColor;
|
||||||
|
}else if(now.minute()==now.hour()){
|
||||||
|
leds[periodic[now.second()]] = secondColor;
|
||||||
|
leds[periodic[now.minute()]] = HMoverlap;
|
||||||
|
}else{
|
||||||
|
leds[periodic[now.second()]] = secondColor;
|
||||||
|
leds[periodic[now.minute()]] = minuteColor;
|
||||||
|
leds[periodic[now.hour()]] = hourColor;
|
||||||
|
}
|
||||||
|
FastLED.show();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
blinkState = false;
|
||||||
|
|
||||||
|
leds[periodic[now.minute()]] = CRGB::Black;
|
||||||
|
|
||||||
|
FastLED.show();
|
||||||
|
// leds[periodic[now.hour()]] = CRGB::Black;
|
||||||
|
// leds[periodic[now.second()]] = CRGB::Black;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!menuTriggered){
|
||||||
|
Serial.println("menu triggered!!");
|
||||||
|
FastLED.clear();
|
||||||
|
menuTriggered = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setHour() {
|
||||||
|
|
||||||
|
// FastLED.clear();
|
||||||
|
actTime = millis();
|
||||||
|
DateTime now = RTC.now();
|
||||||
|
RTC.adjust(DateTime(now.year(), now.month(), now.day(), now.hour(), now.minute(), 1));
|
||||||
|
if(!menuTriggered){
|
||||||
|
Serial.println("menu triggered!!");
|
||||||
|
FastLED.clear();
|
||||||
|
menuTriggered = true;
|
||||||
|
}
|
||||||
|
if(digitalRead(upButton) && buttonPrev2){
|
||||||
|
leds[periodic[now.hour()]] = CRGB::Black;
|
||||||
|
RTC.adjust(DateTime(now.year(), now.month(), now.day(), now.hour()+1, now.minute(), now.second()));
|
||||||
|
}else if(digitalRead(downButton) && buttonPrev3){
|
||||||
|
leds[periodic[now.hour()]] = CRGB::Black;
|
||||||
|
RTC.adjust(DateTime(now.year(), now.month(), now.day(), now.hour()-1, now.minute(), now.second()));
|
||||||
|
}
|
||||||
|
buttonPrev2 = !digitalRead(upButton);
|
||||||
|
buttonPrev3 = !digitalRead(downButton);
|
||||||
|
|
||||||
|
if (actTime - remTime >= period){
|
||||||
|
remTime = actTime;
|
||||||
|
if(!blinkState) {
|
||||||
|
blinkState = true;
|
||||||
|
Serial.print(now.hour(), DEC);
|
||||||
|
Serial.print(':');
|
||||||
|
Serial.print(now.minute(), DEC);
|
||||||
|
Serial.print(':');
|
||||||
|
Serial.print(now.second(), DEC);
|
||||||
|
Serial.println();
|
||||||
|
if(now.second()==now.minute()){
|
||||||
|
leds[periodic[now.second()]] = MSoverlap;
|
||||||
|
leds[periodic[now.hour()]] = hourColor;
|
||||||
|
}else if(now.second()==now.hour()){
|
||||||
|
leds[periodic[now.second()]] = SHoverlap;
|
||||||
|
leds[periodic[now.minute()]] = minuteColor;
|
||||||
|
}else if(now.minute()==now.hour()){
|
||||||
|
leds[periodic[now.second()]] = secondColor;
|
||||||
|
leds[periodic[now.minute()]] = HMoverlap;
|
||||||
|
}else{
|
||||||
|
leds[periodic[now.second()]] = secondColor;
|
||||||
|
leds[periodic[now.minute()]] = minuteColor;
|
||||||
|
leds[periodic[now.hour()]] = hourColor;
|
||||||
|
}
|
||||||
|
FastLED.show();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
blinkState = false;
|
||||||
|
|
||||||
|
leds[periodic[now.hour()]] = CRGB::Black;
|
||||||
|
|
||||||
|
FastLED.show();
|
||||||
|
// leds[periodic[now.hour()]] = CRGB::Black;
|
||||||
|
// leds[periodic[now.second()]] = CRGB::Black;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void increaseBrightness(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
2207
Periodic+Table.ai
Normal file
2207
Periodic+Table.ai
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user