Loading...
  Show Posts
Pages: [1] 2
1  Using Arduino / LEDs and Multiplexing / Re: LED matrix, different brightness on: January 16, 2013, 02:40:34 pm
Does anybody have an idea??
2  Using Arduino / LEDs and Multiplexing / Re: LED matrix, different brightness on: January 16, 2013, 01:24:43 pm
Sorry for my late answer, here's the code. May it occur because of my "time- asking"? I'm using RTClib.h and I am always asking for the time at the beginning of the loop. Does this lead to my dark LEDs?

The sketch works well, the matrix shows the correct time.
While I'm uploading, some LEDs light up (always other ones). They light up very bright, so the mistake cannot be in the hardware.
I'd be very glad if somebody could show me how to handle the DS1307 module exactly!
max
Code:


/*Wortuhr
 **4AHETE, 9.1.2013
 V1.0

 */

#include <Wire.h>
#include "DS1307.h"
#include "Button.h"
#include "Zahlen.h"
#include "Buchstaben.h"
#include "RTClib.h"
#include "ShiftRegister.h"



#define VOR          matrix[3] |= 0b1110000000000000
#define NACH         matrix[3] |= 0b0000000111100000
#define ESIST        matrix[0] |= 0b1101110000000000
#define UHR          matrix[9] |= 0b0000000011100000

#define FUENF        matrix[0] |= 0b0000000111100000
#define ZEHN         matrix[1] |= 0b1111000000000000
#define VIERTEL      matrix[2] |= 0b0000111111100000
#define ZWANZIG      matrix[1] |= 0b0000111111100000
#define HALB         matrix[4] |= 0b1111000000000000
#define DREIVIERTEL  matrix[2] |= 0b1111111111100000

#define H_EIN        matrix[5] |= 0b1110000000000000
#define H_EINS       matrix[5] |= 0b1111000000000000
#define H_ZWEI       matrix[5] |= 0b0000000111100000
#define H_DREI       matrix[6] |= 0b1111000000000000
#define H_VIER       matrix[6] |= 0b0000000111100000
#define H_FUENF      matrix[4] |= 0b0000000111100000
#define H_SECHS      matrix[7] |= 0b1111100000000000
#define H_SIEBEN     matrix[8] |= 0b1111110000000000
#define H_ACHT       matrix[7] |= 0b0000000111100000
#define H_NEUN       matrix[9] |= 0b0001111000000000
#define H_ZEHN       matrix[9] |= 0b1111000000000000
#define H_ELF        matrix[4] |= 0b0000011100000000
#define H_ZWOELF     matrix[8] |= 0b0000001111100000
#define UPSIDEDOWN 9-
int datapin             =   3;
int output_enable       =   5;
int clock               =   13;
int latch               =   2;
int helpState = 0;

ShiftRegister shiftRegister(3, 13, 2);


Button modePlusButton(7);
Button modeMinusButton(12);



byte linesToWrite = 10;

#define MIN 0
#define NORMAL 1
#define SECONDS 2
#define MINUTES 3
#define HOURS 4
#define SCRAMBLE 5
#define BLANK 6
#define ALL 7
#define MAX 8
int mode = NORMAL;
word matrix[16];

RTC_DS1307 RTC;


void setup()
{

  Wire.begin();
  RTC.begin();
  Serial.begin(57600);
  pinMode(datapin, OUTPUT);
  pinMode(output_enable,OUTPUT);
  pinMode(latch, OUTPUT);
  pinMode(clock, OUTPUT);
  digitalWrite(output_enable, LOW);
  RTC.adjust(DateTime(__DATE__, __TIME__));


}

void loop()

  DateTime now = RTC.now();
  int Stunden = now.hour();
  int Minuten = now.minute();
  int Sekunden = now.second();

  Serial.print(now.year(), DEC);
  Serial.print('/');
  Serial.print(now.month(), DEC);
  Serial.print('/');
  Serial.print(now.day(), DEC);
  Serial.print(' ');
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');
  Serial.print(now.second(), DEC);
  Serial.println();
  switch (mode) {

  case NORMAL:
    clearScreenBuffer();
    setWords(Stunden, Minuten);
    setMinutes(Minuten);
    Serial.println(Stunden);
    Serial.println(Minuten);
   case 2:
    matrix[1] |= 0b0000000000010000;
    matrix[0] |= 0b0000000000001000;
    break;
  case 3:
    matrix[1] |= 0b0000000000010000;
    matrix[0] |= 0b0000000000001000;
    matrix[3] |= 0b0000000000000100;
    break;
  case 4:
    matrix[1] |= 0b0000000000010000;
    matrix[0] |= 0b0000000000001000;
    matrix[3] |= 0b0000000000000100;
    matrix[2] |= 0b0000000000000010;
    break;
  }
}

void setWords(int hours, int minutes) {
  while (hours > 12) {
    hours -= 12;
  }

  ESIST;

  switch (minutes / 5) {
  case 0:
    // glatte Stunde
    setHours(hours, true);
    break;
  case 1:
    // 5 nach
    FUENF;
    NACH;
    setHours(hours, false);
    break;
  case 2:
    // 10 nach
    ZEHN;
    NACH;
    setHours(hours, false);
    break;
  case 3:
    // viertel
    VIERTEL;
    setHours(hours + 1, false);
    break;
  case 4:
    // 20 nach
    ZWANZIG;
    NACH;
    setHours(hours, false);
    break;
  case 5:
    // 5 vor halb
    FUENF;
    VOR;
    HALB;
    setHours(hours + 1, false);
    break;
  case 6:
    // halb
    HALB;
    setHours(hours + 1, false);
    break;
  case 7:
    // 5 nach halb
    FUENF;
    NACH;
    HALB;
    setHours(hours + 1, false);
    break;
  case 8:
    // 20 vor
    ZWANZIG;
    VOR;
    setHours(hours + 1, false);
    break;
  case 9:
    // dreiviertel
    DREIVIERTEL;
    setHours(hours + 1, false);
    break;
  case 10:
    // 10 vor
    ZEHN;
    VOR;
    setHours(hours + 1, false);
    break;
  case 11:
    // 5 vor
    FUENF;
    VOR;
    setHours(hours + 1, false);
    break;
  }
}

void setHours(int hours, boolean glatt)
{
  while (hours > 12)
  {
    hours -= 12;
  }

  if (glatt)
  {
    UHR;
  }

  switch (hours)
  {
  case 0:
  case 12:
  case 24:
    H_ZWOELF;
    break;
  case 1:
  case 13:
    if (glatt)
    {
      H_EIN;
    } 
    else
    {
      H_EINS;
    }
    break;
  case 2:
  case 14:
    H_ZWEI;
    break;
  case 3:
  case 15:
    H_DREI;
    break;
  case 4:
  case 16:
    H_VIER;
    break;
  case 5:
  case 17:
    H_FUENF;
    break;
  case 6:
  case 18:
    H_SECHS;
    break;
  case 7:
  case 19:
    H_SIEBEN;
    break;
  case 8:
  case 20:
    H_ACHT;
    break;
  case 9:
  case 21:
    H_NEUN;
    break;
  case 10:
  case 22:
    H_ZEHN;
    break;
  case 11:
  case 23:
    H_ELF;
    break;
  }
}


void scrambleScreenBuffer()
{
  for (int i = 0; i < 16; i++)
  {
    matrix[i] = random(65536);
  }
}


void clearScreenBuffer()
{
  for (int i = 0; i < 16; i++)
  {
    matrix[i] = 0;
  }
}


void setAllScreenBuffer()
{
  for (int i = 0; i < 16; i++)
  {
    matrix[i] = 65535;
  }
}


void writeMatrix()
{

  word row = 1;

  for (int k = 0; k < linesToWrite; k++)
  { 

    shiftRegister.prepareShiftregisterWrite();
    shiftRegister.shiftOut(~matrix[UPSIDEDOWN k]);
    shiftRegister.shiftOut(row);
    shiftRegister.finishShiftregisterWrite();
    row = row << 1;
  }



}


3  International / Deutsch / LED matrix, unterschiedliche Helligkeit on: January 14, 2013, 06:39:19 pm
Hallo,
ich habe über Schieberegister eine 10x11 Matrix aufgebaut. Wenn ich alle LEDs einschalte, leuchtet die vorletzte Reihe am hellsten, so wie die LEDs leuchten sollten. Leider sind aber die anderen LEDs dunkler.
An der Versorgung kann's eigentlich nicht liegen, denn nach dem Schieberegister habe ich Darlington-Verstärkerstufen-Arrays (UDN2981A) eingebaut, die ja das Signal vom Arduino verstärken, da die LEDs mehr Strom brauchen.

Hat jemand eine Idee bzw. ist auch schon bei wem aufgetreten? Wäre sehr dankbar für Lösungsvorschläge!

Danke!
4  Using Arduino / LEDs and Multiplexing / LED matrix, different brightness on: January 14, 2013, 06:35:06 pm
Hello,
in my 10 x 11 matrix occurs a (for me) strange thing: Although the anodes are supplied with  Darlington-Arrays (to strengthen the signal form Arduino Uno) (UDN2981A), the 9th row is the brightest. I usually wanted all LEDs with this brightness, but the others are all darker.

Who can help me?
Thanks!
5  Using Arduino / Programming Questions / RTC DS1307 library on: January 10, 2013, 05:00:05 pm
Hi,

i want to create a simple clock. Therefor I use the RTC DS1307 module. I'm really searching for a library, which is described easily.

I found a tutorial with a library called "RTClib.h". I downloaded the RTClib.h and the RTClib.cpp and added this to my projekt like this: (first picture) (this are tabs next to my main code)

Then I wanted to include the informations I got from the example sketch (http://www.ladyada.net/learn/breakoutplus/ds1307rtc.html) to my program. But when I started with the first command "RTC.begin();", I got an errorlike this (2nd attachment).

I'm sure that I inluded the library in a wrong way. How do I have to do this?
6  International / Deutsch / Frage zu Bibliotheken on: January 10, 2013, 06:17:15 am
Hallo,
ich hab da mal ne Frage zu den Bibliotheken. Ich habe von einem Freund ein Programm bekommen, indem einige Bibliotheken inkludiert sind. (z.B.: #include "Zahlen.h")

auf seiner Homepage findet man die Datei "Zahlen.h" zum Download, nur wenn ich diese Datei im Ordner "libraries" bei Arduino hinzufüge, findet sie der Compiler nicht. Was muss ich da machen? Wie findet sie der Compiler? Oder ist die Zahlen.h allein keine Bibliothek?

Danke für eure Hilfe!

lg max
7  Using Arduino / Programming Questions / Re: difference Serial.print("Hello World") / Serial.println("Hello World") on: January 09, 2013, 01:59:16 pm
Ah ok thanks, I've just seen this smiley
8  Using Arduino / Programming Questions / difference Serial.print("Hello World") / Serial.println("Hello World") on: January 09, 2013, 01:36:47 pm
Hi, unfortunately I cannot spot out the difference. Can someone help me please?  smiley

By the way, I can split my project into 2 programs (just 2 tabs in the Arduino DE), right?

Thanks
9  Using Arduino / Programming Questions / Re: Shift Register Library on: January 08, 2013, 05:36:00 pm
I want to control a matrix without using shiftout(), because that would enlarge my program wouldn't it?
10  Using Arduino / Programming Questions / Shift Register Library on: January 08, 2013, 04:49:44 pm
Hi,

I have 4 daisy-chained shift registers. I just wanted to know if anybody knows a special library which makes programming much easier.

Thanks,
max
11  Using Arduino / Project Guidance / Re: Schematic for Word-Clock using Arduino UNO on: December 13, 2012, 02:07:17 am
That's why I have the Darlington Arrays
12  Using Arduino / Project Guidance / Re: Schematic for Word-Clock using Arduino UNO on: December 12, 2012, 01:43:56 pm
alright, thanks!
I just wanted to get sure because the board will already be etched on friday
13  Using Arduino / Project Guidance / Schematic for Word-Clock using Arduino UNO on: December 12, 2012, 01:31:57 pm
Hi guys,
I am making a wordclock with an LED matrix, please check the schematics for any mistakes.
Thanks!!

Max
14  Using Arduino / LEDs and Multiplexing / Re: 11 x 10 LED Matrix MAX7219? on: December 09, 2012, 01:49:59 pm
i couldn't try this yet. what about the other idea if that doesn't work?
15  Using Arduino / LEDs and Multiplexing / Re: 11 x 10 LED Matrix MAX7219? on: December 07, 2012, 05:27:19 am
I've tried to control the brightness with the Output Enable pin, but that didn't work very well.
Code:
int datapin = 13;
int clockpin = 12;
int output_enable = 11;
int latchpin = 8;
byte test[1];
int x = 0;
int brightness;
int potentiometer = A0;

void setup()
{
  Serial.begin(9600);
  pinMode(datapin,OUTPUT);
  pinMode(latchpin,OUTPUT);
  pinMode(clockpin,OUTPUT);
  pinMode(output_enable,OUTPUT);
  test[1] = 0b11111111;
}

void loop()
{
  brightness = analogRead(A0);
  analogWrite(output_enable, brightness);

  digitalWrite(latchpin, LOW);
  shiftOut(datapin, clockpin, MSBFIRST, test[1]);
  digitalWrite(latchpin, HIGH);
}


Where is the mistake?

It works much better when a potentiometer is connected in series to the supply voltage input, the LEDs go fluently from dark to light, but does this also work when a Darlington Array is also connected in series (to supply the LEDs)?
Pages: [1] 2