arduino led 8x8led
Post on 24-Feb-2018
222 Views
Preview:
TRANSCRIPT
-
7/25/2019 Arduino LED 8x8LED
1/18
Running LED
.
-
7/25/2019 Arduino LED 8x8LED
2/18
Led 8x8 LED 2
-
7/25/2019 Arduino LED 8x8LED
3/18
Led 8x8 LED
unsigned char flash;
void setup() {DDRD = B11111111; //Port D as output
}
void loop() {
flash = B10000000;
for(int i = 0;i>=1;
}
} 3
-
7/25/2019 Arduino LED 8x8LED
4/18
Led 8x8 LED
1. unsigned char flash; char flash;
2. flash>>=1; flash
-
7/25/2019 Arduino LED 8x8LED
5/18
8x8 LED Dot Matrix
Led 8x8 LED 5
-
7/25/2019 Arduino LED 8x8LED
6/18
5x7 LED Dot Matrix
Led 8x8 LED 6
-
7/25/2019 Arduino LED 8x8LED
7/18
8x8 LED Dot Matrix Arduino
Led 8x8 LED 7
-
7/25/2019 Arduino LED 8x8LED
8/18
Arduino
Led 8x8 LED 8
-
7/25/2019 Arduino LED 8x8LED
9/18
Timer Counter ATMega168
Led 8x8 LED 9
-
7/25/2019 Arduino LED 8x8LED
10/18
Timer1
ATMega168
Led 8x8 LED
TCCR1A Timer/Counter 1 Control Register ATCCR1B Timer/Counter 1 Control Register BTCCR1C Timer/Counter 1 Control Register CTCNT1H Timer/Counter 1 High RegisterTCNT1L Timer/Counter 1 Low Register
OCR1AH Output Compare Register 1 A HighOCR1AL Output Compare Register 1 A LowOCR1BH Output Compare Register 1 B HighOCR1BL Output Compare Register 1 B LowICR1H Input Capture Register 1 HighICR1L Input Capture Register 1 Low
TIMSK1 Timer/Counter Interrupt Mask RegisterTIFR1 Timer/Counter Interrupt Flag Register
http://www.protostack.com/blog/2010/09/timer-interrupts-on-an-atmega168/
10
-
7/25/2019 Arduino LED 8x8LED
11/18
Timer1Arduino
Led 8x8 LED
Library timer 11.
http://www.arduino.cc/playground/code/timer1
LAB
2. Copy Mylibraries Sketch
Arduino \Arduino\libraries
11
-
7/25/2019 Arduino LED 8x8LED
12/18
Libraries Timer1
Timer1.initialize(n);
timer 1 nmicroseconds n long
Timer1.attachInterrupt( timerIsr );
http://playground.arduino.cc/code/timer1
Led 8x8 LED 12
http://playground.arduino.cc/code/timer1http://playground.arduino.cc/code/timer1http://playground.arduino.cc/code/timer1 -
7/25/2019 Arduino LED 8x8LED
13/18
#include //TimerOne
unsigned char col;//const unsigned char pattern[] = {0xff,0x7e,0x3c,0x18,0x81,0x42,0x24,0x18};unsigned char dis_buf[8]; //
//--------------------------------------------------------------------------------
void setup() {DDRD = B11111111; //Port D as outputDDRC = B11111111; //Port C as outputDDRB = B11111111; //Port B as output
// timer 1 1000 microsecondsTimer1.initialize(1000);Timer1.attachInterrupt( timerIsr ); //
col = 0;copymem(pattern); //
}
Led 8x8 LED 13
-
7/25/2019 Arduino LED 8x8LED
14/18
()
void copymem(const unsigned char image[]){int i;for (i=0;i
-
7/25/2019 Arduino LED 8x8LED
15/18
()//--------------------------------------------------------------------------------
/// Scan display/// 1 //--------------------------------------------------------------------------------void timerIsr(){
switch (col) {case 0:PORTD = dis_buf[col];PORTC = 0B11111110;PORTB = 0B11111111;break;
case 1:PORTD = dis_buf[col];PORTC = 0B11111101;PORTB = 0B11111111;
break;case 2:PORTD = dis_buf[col];PORTC = 0B11111011;PORTB = 0B11111111;break;
Led 8x8 LED 15
-
7/25/2019 Arduino LED 8x8LED
16/18
()
case 3:PORTD = dis_buf[col];PORTC = 0B11110111;PORTB = 0B11111111;break;
case 4:PORTD = dis_buf[col];PORTC = 0B11101111;PORTB = 0B11111111;break;
case 5:
PORTD = dis_buf[col];PORTC = 0B11011111;PORTB = 0B11111111;break;
Led 8x8 LED 16
-
7/25/2019 Arduino LED 8x8LED
17/18
()
case 6:PORTD = dis_buf[col];PORTC = 0B11111111;PORTB = 0B11101111;break;
case 7:PORTD = dis_buf[col];PORTC = 0B11111111;PORTB = 0B11011111;break;
}col++;if (col > 7) col = 0;
}
Led 8x8 LED 17
-
7/25/2019 Arduino LED 8x8LED
18/18
Led 8x8 LED
1
18
top related