Filodrammatica ViVa di Vigolo Vattaro - Altopiano della Vigolana (Trento) - Italia

Menu  Menu
Notizie
Attivitą
Tabella attivitą
Rassegne
Spettacoli
Scritti
Notizie dall'interno
Guide
Software/Hardware libero
Miei progetti
Mappa sito
Foto
Download
Mio curriculum
Dove siamo

Vedi anche  Vedi anche
 Alimentatore led high power 3W
 Maschere della commedia dell'arte in carta e cartone
 PyWiiMote
 Palla a led
 Scritta con striscia a led
 Penna a infrarossi
 Nuova penna a infrarossi
 Papercraft
 Arduino
 Relazione 2012
 RepRap e Openscad
 Disegni con Openscad
 Torre di Tesla
 Lampada portatile
 Lampada portatile RGBW
 Misuratore allungamento molla con lo wiimote
 Deviata a led
 Lampada magica
 Chimica
 Cubo a led 8x8x8
 Basic
 LedRGB_IR
 Termometro igrometro digitale con Arduino
 Pannello elettrico
 Quadricottero open
 Pannello a led RGB
 Supporto rocchetto RepRap
 Lampada magica versione due
 The Folding Arduino Lab
 Orologio a led con Arduino
 Taglierina laser
 Scritta RGB con Arduino
 Taglierina per polistirolo
 Scaletta-pedana
 Orologio con WS2812
 LightBox Led Dimmer

Miei progetti » Orologio con WS2812

OROLOGIO CON WS2812

Per realizzare questo semplice progetto userò un Arduino Uno (va bene anche un Nano), un modulo RTC e 4 semicerchi da 90° di led WS2812.


// Scritto da Giuseppe Tamanini 17/04/2020 di pubblico dominio
#include <Wire.h>
#include "RTClib.h"
#include <WS2812.h>
 
RTC_DS1307 rtc;
#define outputPin 8  // Digital output pin command WS2812
#define LEDCount 60   // Number of LEDs WS2812
WS2812 LED(LEDCount);
cRGB value;
 
byte holdminute=99;
byte holdsecond=99;
 
int hh = 0;
int hho = 0;
int oldhh = - 99;
int mm=0;;
int ss=0;
boolean mh=true;
 
void setup() {
  Serial.begin(9600);
  LED.setOutput(outputPin);
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }
  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
  }
}
 
void loop() {
  // put your main code here, to run repeatedly:
 DateTime now = rtc.now();
  ss = now.second(); 
  if (holdsecond != ss) {
    mm = now.minute();
    hh = now.hour();
    hho = hh;
    if (hh > 11) {
      hho = hh - 12;
    }
    hho = hho * 5 + mm / 12;
    holdsecond = ss;
    AccendiLed();
  }
}
 
void AccendiLed() {
  for (int i = 0; i < 60; i++) {
    value.b = 5; value.g = 5; value.r =0; // RGB Value -> Blue
    LED.set_crgb_at(i, value); // Set value at LED found at index 0
  }
  value.b = 0; value.g = 127; value.r =255; // RGB Value -> Blue
  LED.set_crgb_at(mm, value); // Set value at LED found at index 0
  value.b = 0; value.g = 0; value.r =255; // RGB Value -> Blue
  LED.set_crgb_at(hho, value); // Set value at LED found at index 0
  if (mm == hho && mh == true) {
    value.b = 0; value.g = 255; value.r =0; // RGB Value -> Blue
    LED.set_crgb_at(mm, value); // Set value at LED found at index 0
    mh = false;
  }
  else if (mm == hho && mh == false) {
    mh = true;
  }
  value.b = 127; value.g = 127; value.r = 0; // RGB Value -> Blue
  LED.set_crgb_at(ss, value); // Set value at LED found at index 0
  if (ss == hho) {
    value.b = 127; value.g = 0; value.r =127; // RGB Value -> Blue
    LED.set_crgb_at(ss, value); // Set value at LED found at index 0
}
  if (ss == mm) {
    value.b = 0; value.g = 127; value.r =127; // RGB Value -> Blue
    LED.set_crgb_at(mm, value); // Set value at LED found at index 0
  }
  LED.sync(); // Sends the value to the LED
}
print
Calendario  Calendario
Aprile 2024
L M M G V S D
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30

Data: 25/04/2024
Ora: 21:47
Accadde Oggi:
* 1983 - Il Pioneer 10 entra nell'orbita del pianeta Plutone

Santi Cattolici:
* San Marco Evangelista

Meteo  Meteo
Meteo Vigolo