Used an ATTINY 2123 to directly control LED on picture frame. Flashes several patterns.

Code:

/*

Playing with generating and trapping interrupts using the Arduino and
an ATtiny2313.

Simple LED blinker, pin 9 will actually be connected to the ATtiny.

*/
byte led_pin16 = 16;
byte led_pin15= 15;
byte led_pin14= 14;
byte led_pin13= 13;
byte led_pin12 = 12;
byte led_pin11 = 11;
byte led_pin10 = 10;
byte led_pin9= 8;
byte led_pin8 = 9;
byte led_pin7 = 7;
byte led_pin6= 6;
byte led_pin5= 5;
byte led_pin4 = 4;
byte led_pin3= 3;
byte led_pin2= 2;



void setup() {
// put your setup code here, to run once:
pinMode(led_pin16, OUTPUT);
pinMode(led_pin15, OUTPUT);
pinMode(led_pin14, OUTPUT);
pinMode(led_pin13, OUTPUT);
pinMode(led_pin12, OUTPUT);
pinMode(led_pin11, OUTPUT);
pinMode(led_pin10, OUTPUT);
pinMode(led_pin9, OUTPUT);
pinMode(led_pin8, OUTPUT);
pinMode(led_pin7, OUTPUT);
pinMode(led_pin6, OUTPUT);
pinMode(led_pin5, OUTPUT);
pinMode(led_pin4, OUTPUT);
pinMode(led_pin3, OUTPUT);
pinMode(led_pin2, OUTPUT);


}
void loop() {

insequence();
steps();
circlesequence();
circleback();
randomblink();
}

void randomblink() {
int j=0;
int randNumber=0;
int randNumber1=0;
for (j=1;j<=25;j++){
randNumber = random(2,17);
randNumber1 = random(2,17);
digitalWrite(randNumber, HIGH);
delay(25); // wait for a second
digitalWrite(randNumber, LOW);
delay(50); // wait for a second
digitalWrite(randNumber1, HIGH);
delay(25); // wait for a second
digitalWrite(randNumber1, LOW);
delay(50); // wait for a second
}
delay(50);
}


void insequence() {

int i=0;
int j=0;
for (j=1;j<=4;j++){
for (i=1;i<=16;i++){
digitalWrite(i, HIGH);
delay(50);
digitalWrite(i, LOW);
delay(50);}
for (i=16;i>0;i--){
digitalWrite(i, HIGH);
delay(50);
digitalWrite(i, LOW);
delay(50);}}

}

void circleback() {

int i=0;
int j=0;
for (j=1;j<=4;j++){
for (i=16;i>0;i--){
digitalWrite(i, HIGH);
delay(50);
digitalWrite(i, LOW);
delay(50);}}

}

void circlesequence() {

int i=0;
int j=0;
for (j=1;j<=4;j++){
for (i=1;i<=16;i++){
digitalWrite(i, HIGH);
delay(25);
digitalWrite(i, LOW);
delay(25);}}

}

void steps() {
// put your main code here, to run repeatedly:
int i=0;
int j=0;
for (j=1;j<=4;j++){
for (i=1;i<=14;i=i+2){
digitalWrite(i, HIGH);
digitalWrite(i+1, HIGH);
digitalWrite(i+2, HIGH);
digitalWrite(i+3, HIGH);

delay(50);
digitalWrite(i, LOW);
digitalWrite(i+1,LOW);
digitalWrite(i+2,LOW);
digitalWrite(i+3,LOW);

delay(50);}

}}

Views: 294

Comment

You need to be a member of GarageLab (arduino, electronics, robotics, hacking) to add comments!

Join GarageLab (arduino, electronics, robotics, hacking)

Latest Activity

Marcelo Rodrigues replied to GarageLab's discussion Serious claims against BeagleBone's manufacturer CircuitCo
"Ed, No, they didn't deliver yet.  :( Good luck for us all."
Thursday
Profile IconWesenachin Asfaw and Muhammad Basil joined GarageLab (arduino, electronics, robotics, hacking)
Thursday
Marcelo Rodrigues replied to FiniousFingers's discussion New to group
"Hey man! A good point to start is reading basic tutorials on Arduino coding and wiring. Then, you…"
Thursday
FiniousFingers posted a discussion

New to group

Couple quick things,I am just starting to learn, or wanting to learn, how to use the Arduino UNO…See More
Thursday
Profile IconDan Urbauer, Bjorn and Jiaming Zhao joined GarageLab (arduino, electronics, robotics, hacking)
Wednesday
FiniousFingers is now a member of GarageLab (arduino, electronics, robotics, hacking)
Monday
Erva updated their profile
Mar 16
Erva and Mrs. Priscilla Bonneval are now friends
Mar 16
Profile IconSamantha Dorr, Lee Robinson and Celso Eiju Ito joined GarageLab (arduino, electronics, robotics, hacking)
Mar 16
Edward Evans updated their profile
Mar 15
Edward Evans replied to GarageLab's discussion Serious claims against BeagleBone's manufacturer CircuitCo
"Hi Marcelo, I am curious if you have had any resolution on this?  We may be in the same boat…"
Mar 15
Celso Eiju Ito left a comment for Mrs. Priscilla Bonneval
"I just accept your invitation. Thank You for contact me. Sincerelly,   'Eiju"
Mar 15
Mohasin Ahamed Chinnapattan commented on Mauro Assis's blog post How to hack a remote control (and a flying shark) I
"You mentioned collector is set to ground but emitter is set to ground in your diagram "
Mar 14
Profile Iconbadrkhan mijbas khalifa, Bethany Cruz, Mrs. Priscilla Bonneval and 1 more joined GarageLab (arduino, electronics, robotics, hacking)
Mar 13
Edward Evans is now a member of GarageLab (arduino, electronics, robotics, hacking)
Mar 9
Profile IconAllan Zilkowsky, Shubham Dewangan, FAUSTO PEREIRA ROMANO and 4 more joined GarageLab (arduino, electronics, robotics, hacking)
Mar 1
Dave Lewing is now a member of GarageLab (arduino, electronics, robotics, hacking)
Feb 27
Profile Iconjames essien and Chow HP joined GarageLab (arduino, electronics, robotics, hacking)
Feb 17
Profile IconPerry Duvall, Irayya Mathad and wiley milam joined GarageLab (arduino, electronics, robotics, hacking)
Feb 16
Profile IconAlan Powell and Chuck Nolan joined GarageLab (arduino, electronics, robotics, hacking)
Feb 9

© 2017   Created by Marcelo Rodrigues.   Powered by

Badges  |  Report an Issue  |  Terms of Service