BCR-1: Difference between revisions

From RevSpace
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:
   }}
   }}


== BCR-1 ===
== 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 ==
 
<pre>#include &lt;Time.h&gt;
#include &lt;DS1302.h&gt;
 
// 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 &lt; pinCount; thisPin++)  {
    pinMode(ledPins[thisPin], OUTPUT);
    digitalWrite(ledPins[thisPin], HIGH);   
    delay(100);
    digitalWrite(ledPins[thisPin], LOW);   
  }
  for (int thisPin = 13; thisPin &gt; 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(&quot;Hour:&quot;);
  Serial.println(uur);
  Serial.println(&quot;Minute:&quot;);
  Serial.println(minu);
  Serial.println(&quot;-End Print-&quot;);
  digitalWrite(uur1, (uur &amp; B0001) );
  digitalWrite(uur2, (uur &amp; B0010) &gt;&gt; 1);
  digitalWrite(uur4, (uur &amp; B0100) &gt;&gt; 2);
  digitalWrite(uur8, (uur &amp; B1000) &gt;&gt; 3);
 
  digitalWrite(min1, (minu &amp; B000001));
  digitalWrite(min2, (minu &amp; B000010) &gt;&gt; 1);
  digitalWrite(min4, (minu &amp; B000100) &gt;&gt; 2);
  digitalWrite(min8, (minu &amp; B001000) &gt;&gt; 3);
  digitalWrite(min16, (minu &amp; B010000) &gt;&gt; 4);
  digitalWrite(min32, (minu &amp; B100000) &gt;&gt; 5);
 
  delay(timer);
}</pre>
 
== Schema ==


Binary Clock 1
Binary Clock 1


[[File:Bb.png]]
[[File:Bb.png | 250px]]
[[File:Schem.png]]
[[File:Schem.png | 250px]]
 
== Images ==
 
[[File:Bcr-1.jpg | 250px]]
[[File:Bcr-breadboard.jpg | 250px]]

Latest revision as of 19:02, 10 May 2014

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