BCR-1

From RevSpace
Revision as of 21:02, 10 May 2014 by Raymii (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Project BCR-1
Status In progress
Contact Raymii
Last Update 2014-05-10

Summary

Simple Binary . Uses an Arduino and the RS302 RTC module.

First draft was on breadbord. Second draft is a solderboard, a Juerd-USB battery and duct tape. Next draft will be case first, then inner works.

Code

#include <Time.h>
#include <DS1302.h>

// License: GPLv3
// by Remy, raymii.org

int ledPins[] = {13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2};
int pinCount = 12;
int timer = 1000;

//vcc = a17 = 3.3v = a2
//gnd = b17 = gnd = a14
//clk = c17 = ard ana 4 = a8
//dat = d17 = ard ana 3 = a7
//rst/ce = e17 = ard ana 2 = a6


DS1302 rtc(A2, A3, A4);
Time t;
//int uur = 0;
//int minu = 0;
#define uur1 6
#define uur2 5
#define uur4 4
#define uur8 3

#define min1 12
#define min2 11
#define min4 10
#define min8 9
#define min16 8
#define min32 7

void setup() {                
  Serial.begin(9600);
  rtc.halt(false);
  rtc.writeProtect(false);

  for (int thisPin = 0; thisPin < pinCount; thisPin++)  {
    pinMode(ledPins[thisPin], OUTPUT);
    digitalWrite(ledPins[thisPin], HIGH);    
    delay(100);
    digitalWrite(ledPins[thisPin], LOW);    
  }
  for (int thisPin = 13; thisPin > 0; thisPin--)  {
    digitalWrite(ledPins[thisPin], HIGH);    
    delay(60);
    digitalWrite(ledPins[thisPin], LOW);    
  }
}


void loop() {
  t = rtc.getTime();
  int uur = t.hour%12; 
  int minu = t.min;
  Serial.println("Hour:");
  Serial.println(uur);
  Serial.println("Minute:");
  Serial.println(minu);
  Serial.println("-End Print-");
  digitalWrite(uur1, (uur & B0001) );
  digitalWrite(uur2, (uur & B0010) >> 1);
  digitalWrite(uur4, (uur & B0100) >> 2);
  digitalWrite(uur8, (uur & B1000) >> 3);

  digitalWrite(min1, (minu & B000001));
  digitalWrite(min2, (minu & B000010) >> 1);
  digitalWrite(min4, (minu & B000100) >> 2);
  digitalWrite(min8, (minu & B001000) >> 3);
  digitalWrite(min16, (minu & B010000) >> 4);
  digitalWrite(min32, (minu & B100000) >> 5);

  delay(timer);
}

Schema

Binary Clock 1

Bb.png Schem.png

Images

Bcr-1.jpg Bcr-breadboard.jpg