Monday, 26 February 2018
Saturday, 17 February 2018
Arduino LED 8 x 8 (Blinking Heart)
Interfacing a 8X8 LED dot matrix with an Arduino Uno 3 to display a Blinking Heart
Video:
Steps followed:
- Perform the wiring diagram as displayed in this article Interfacing 8 x 8 LED
- Change the code as below to display a blinking heart:
//Define Variables:
byte Heart_Min[] = {B00000000,B00000000,B00011000,B00111100,B00111100,B00011000,B00000000,B00000000};
byte Heart[] = {B00000000,B01100110,B11111111,B11111111,B01111110,B00111100,B00011000,B00000000};
//Change loop method as below
void loop() {
delay(5);
timeCount += 1;
if(timeCount < 70) {
drawScreen(Heart_Min);
} else if (timeCount < 150) {
drawScreen(Heart);
} else {
timeCount = 0;
}
}
Complete Code:
Video:
Steps followed:
- Perform the wiring diagram as displayed in this article Interfacing 8 x 8 LED
- Change the code as below to display a blinking heart:
//Define Variables:
byte Heart_Min[] = {B00000000,B00000000,B00011000,B00111100,B00111100,B00011000,B00000000,B00000000};
byte Heart[] = {B00000000,B01100110,B11111111,B11111111,B01111110,B00111100,B00011000,B00000000};
//Change loop method as below
void loop() {
delay(5);
timeCount += 1;
if(timeCount < 70) {
drawScreen(Heart_Min);
} else if (timeCount < 150) {
drawScreen(Heart);
} else {
timeCount = 0;
}
}
Complete Code:
#define ROW_1 2
#define ROW_2 3
#define ROW_3 4
#define ROW_4 5
#define ROW_5 6
#define ROW_6 7
#define ROW_7 8
#define ROW_8 9
#define COL_1 10
#define COL_2 11
#define COL_3 12
#define COL_4 13
#define COL_5 A0
#define COL_6 A1
#define COL_7 A2
#define COL_8 A3
const byte rows[] = {
ROW_1, ROW_2, ROW_3, ROW_4, ROW_5, ROW_6, ROW_7, ROW_8
};
// The display buffer
// It's prefilled with a smiling face (1 = ON, 0 = OFF)
byte Heart_Min[] = {B00000000,B00000000,B00011000,B00111100,B00111100,B00011000,B00000000,B00000000};
byte Heart[] = {B00000000,B01100110,B11111111,B11111111,B01111110,B00111100,B00011000,B00000000};
float timeCount = 0;
void setup() {
// Open serial port
Serial.begin(9600);
// Set all used pins to OUTPUT
// This is very important! If the pins are set to input
// the display will be very dim.
for (byte i = 2; i <= 13; i++)
pinMode(i, OUTPUT);
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT);
}
void loop() {
delay(5);
timeCount += 1;
if(timeCount < 70) {
drawScreen(Heart_Min);
} else if (timeCount < 150) {
drawScreen(Heart);
} else {
timeCount = 0;
}
}
void drawScreen(byte buffer2[]){
// Turn on each row in series
for (byte i = 0; i < 8; i++) {
setColumns(buffer2[i]); // Set columns for this specific row
digitalWrite(rows[i], HIGH);
delay(2); // Set this to 50 or 100 if you want to see the multiplexing effect!
digitalWrite(rows[i], LOW);
}
}
void setColumns(byte b) {
digitalWrite(COL_1, (~b >> 0) & 0x01); // Get the 1st bit: 10000000
digitalWrite(COL_2, (~b >> 1) & 0x01); // Get the 2nd bit: 01000000
digitalWrite(COL_3, (~b >> 2) & 0x01); // Get the 3rd bit: 00100000
digitalWrite(COL_4, (~b >> 3) & 0x01); // Get the 4th bit: 00010000
digitalWrite(COL_5, (~b >> 4) & 0x01); // Get the 5th bit: 00001000
digitalWrite(COL_6, (~b >> 5) & 0x01); // Get the 6th bit: 00000100
digitalWrite(COL_7, (~b >> 6) & 0x01); // Get the 7th bit: 00000010
digitalWrite(COL_8, (~b >> 7) & 0x01); // Get the 8th bit: 00000001
// If the polarity of your matrix is the opposite of mine
// remove all the '~' above.
}
Friday, 16 February 2018
Docker insecure registry configuration in CentOS
To configure insecure docker registeries in CentOS, configure the following ("cat /etc/docker/daemon.json") as below:
{
"insecure-registries" : ["registry1:5000", "registry2:5000"]
}
{
"insecure-registries" : ["registry1:5000", "registry2:5000"]
Tuesday, 30 January 2018
Taking dump of SVN and restoring it
Dump of svn
svnadmin dump D:\SVN\Repository > D:/Jan312018.dump
Load svn
svnadmin load D:\SVN\Repository < D:/Jan312018.dump
svnadmin dump D:\SVN\Repository > D:/Jan312018.dump
Load svn
svnadmin load D:\SVN\Repository < D:/Jan312018.dump
Thursday, 18 January 2018
Installing libstdc++5 32bit on 64 bit ubuntu
sudo apt-get install libstdc++5:i386
The command fails with Unable to locate package
$ sudo dpkg --add-architecture i386 $ sudo dpkg --print-foreign-architectures i386 $ sudo apt-get update $ sudo apt-get install libstdc++5:i386 libstdc++5 for 32bit ll be installed
The command fails with Unable to locate package
$ sudo dpkg --add-architecture i386 $ sudo dpkg --print-foreign-architectures i386 $ sudo apt-get update $ sudo apt-get install libstdc++5:i386 libstdc++5 for 32bit ll be installed
Subscribe to:
Comments (Atom)