parent
b52a35356d
commit
60c69a902b
|
@ -0,0 +1,55 @@
|
||||||
|
// Arduino 7 segment display example software
|
||||||
|
// http://www.hacktronics.com/Tutorials/arduino-and-7-segment-led.html
|
||||||
|
// License: http://www.opensource.org/licenses/mit-license.php (Go crazy)
|
||||||
|
|
||||||
|
// Define the LED digit patters, from 0 - 9
|
||||||
|
// Note that these patterns are for common cathode displays
|
||||||
|
// For common anode displays, change the 1's to 0's and 0's to 1's
|
||||||
|
// 1 = LED on, 0 = LED off, in this order:
|
||||||
|
// Arduino pin: 2,3,4,5,6,7,8
|
||||||
|
|
||||||
|
// Src: http://www.hacktronics.com/Tutorials/arduino-and-7-segment-led.html
|
||||||
|
|
||||||
|
byte seven_seg_digits[10][7] = { { 1,1,1,1,1,1,0 }, // = 0
|
||||||
|
{ 0,1,1,0,0,0,0 }, // = 1
|
||||||
|
{ 1,1,0,1,1,0,1 }, // = 2
|
||||||
|
{ 1,1,1,1,0,0,1 }, // = 3
|
||||||
|
{ 0,1,1,0,0,1,1 }, // = 4
|
||||||
|
{ 1,0,1,1,0,1,1 }, // = 5
|
||||||
|
{ 1,0,1,1,1,1,1 }, // = 6
|
||||||
|
{ 1,1,1,0,0,0,0 }, // = 7
|
||||||
|
{ 1,1,1,1,1,1,1 }, // = 8
|
||||||
|
{ 1,1,1,0,0,1,1 } // = 9
|
||||||
|
};
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
pinMode(2, OUTPUT);
|
||||||
|
pinMode(3, OUTPUT);
|
||||||
|
pinMode(4, OUTPUT);
|
||||||
|
pinMode(5, OUTPUT);
|
||||||
|
pinMode(6, OUTPUT);
|
||||||
|
pinMode(7, OUTPUT);
|
||||||
|
pinMode(8, OUTPUT);
|
||||||
|
pinMode(9, OUTPUT);
|
||||||
|
writeDot(0); // start with the "dot" off
|
||||||
|
}
|
||||||
|
|
||||||
|
void writeDot(byte dot) {
|
||||||
|
digitalWrite(9, dot);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sevenSegWrite(byte digit) {
|
||||||
|
byte pin = 2;
|
||||||
|
for (byte segCount = 0; segCount < 7; ++segCount) {
|
||||||
|
digitalWrite(pin, seven_seg_digits[digit][segCount]);
|
||||||
|
++pin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
for (byte count = 10; count > 0; --count) {
|
||||||
|
delay(1000);
|
||||||
|
sevenSegWrite(count - 1);
|
||||||
|
}
|
||||||
|
delay(4000);
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
This is the Proof of Concept code for the 4x5 Windows mock-up.
|
||||||
|
With a 4-7Segment Display
|
||||||
|
|
||||||
|
It is a static mockup that should be used to make a Video and show off the theory of the project.
|
||||||
|
|
||||||
|
The shift Array code is from this Tutorial page:
|
||||||
|
|
||||||
|
http://arduino.cc/en/Tutorial/ShiftOut
|
||||||
|
|
||||||
|
General information about shift registers: http://en.wikipedia.org/wiki/Shift_register
|
||||||
|
|
||||||
|
The one used for driving the 7 segment LED is a standard (SN)74HC595 which is an 8bit Shift register.
|
||||||
|
Datasheet: http://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf
|
||||||
|
|
||||||
|
The used module is a 16 segment element with one decimal dot (http://www.adafruit.com/datasheets/BL-S80A-13.PDF)
|
||||||
|
UHR (Ultra High Red) version
|
||||||
|
|
||||||
|
We used a single in-line i(SIL) resistor to make our lives easy. http://en.wikipedia.org/wiki/Resistor
|
|
@ -0,0 +1,56 @@
|
||||||
|
// testcolors demo for RGBmatrixPanel library.
|
||||||
|
// Renders 512 colors on a 16x32 RGB LED matrix.
|
||||||
|
// Library supports 4096 colors, but there aren't that many pixels!
|
||||||
|
|
||||||
|
#include <Adafruit_GFX.h> // Core graphics library
|
||||||
|
#include <RGBmatrixPanel.h> // Hardware-specific library
|
||||||
|
|
||||||
|
#define CLK 8 // MUST be on PORTB!
|
||||||
|
#define LAT A3
|
||||||
|
#define OE 9
|
||||||
|
#define A A0
|
||||||
|
#define B A1
|
||||||
|
#define C A2
|
||||||
|
|
||||||
|
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
matrix.begin();
|
||||||
|
uint8_t r=0, g=0, b=0;
|
||||||
|
|
||||||
|
// Draw top half
|
||||||
|
for (uint8_t x=0; x < 32; x++) {
|
||||||
|
for (uint8_t y=0; y < 8; y++) {
|
||||||
|
matrix.drawPixel(x, y, matrix.Color333(r, g, b));
|
||||||
|
r++;
|
||||||
|
if (r == 8) {
|
||||||
|
r = 0;
|
||||||
|
g++;
|
||||||
|
if (g == 8) {
|
||||||
|
g = 0;
|
||||||
|
b++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw bottom half
|
||||||
|
for (uint8_t x=0; x < 32; x++) {
|
||||||
|
for (uint8_t y=8; y < 16; y++) {
|
||||||
|
matrix.drawPixel(x, y, matrix.Color333(r, g, b));
|
||||||
|
r++;
|
||||||
|
if (r == 8) {
|
||||||
|
r = 0;
|
||||||
|
g++;
|
||||||
|
if (g == 8) {
|
||||||
|
g = 0;
|
||||||
|
b++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// do nothing
|
||||||
|
}
|
Loading…
Reference in New Issue