Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include <util/delay.h>
- #include <alloca.h>
- #include <avr/cpufunc.h>
- uint8_t j = 1;
- int main(void){
- uint8_t i = 0;
- DDRA = 0xff;
- DDRB = 0x00;
- PORTB = 0xFF;
- char *p = malloc(256*sizeof(char));
- for(i=0;i<256;i++){
- p[i] = j;
- j = (j<<1)&0xff;
- if(j == 0){ j = 1; }
- }
- while(1){
- if(PINB == 0x2a){
- p[i] = (p[i] + 2)&0xff;
- }
- PORTA = p[i]&0xff;
- i++;
- if(i==256){i=0;}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement