Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define DDR_N (DDRB)
- #define PORT_N (PORTB)
- #define PIN_N (4)
- #define BIT_SET (1 << PIN_N)
- #define BIT_CLR (B00000000)
- #define PIXEL_COUNT 16
- //NOTE: Colors = G.R.B
- char volatile one [ ] = "00000000.00001111.00000000";
- void setup() {
- DDR_N = BIT_SET;
- for(int j = 0; j < PIXEL_COUNT; j++) {
- for(int i = 0; i < 26; i++) {
- if(one[i] == '1') {
- PORT_N = BIT_SET;
- asm volatile (
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- );
- PORT_N = BIT_CLR;
- asm volatile (
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- );
- } else if(one[i] == '0') {
- PORT_N = BIT_SET;
- asm volatile (
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- );
- PORT_N = BIT_CLR;
- asm volatile (
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- "nop \n\t"
- );
- }
- }
- }
- delayMicroseconds(7);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- }
Add Comment
Please, Sign In to add comment