In this Project you can see how to make lucid dream mask using
attiny13 smd chip for control your dream.
Parts:
attiny13(I use smd
chip)
4
5mm red led.
Attiny pinout:
how to connect
arduino with attiny13:
you have to
install attiny library and open arduino go to tools ,programmer and select
arduino as isp.
upload ArduinoISP
. select attiny13 to tools board .
connect led in pin 1,2,3,4 of attiny chip.
connect led in pin 1,2,3,4 of attiny chip.
code for attiny13
lucid dream mask:
// per chip perdoret attiny13
int led1 =1;
int led2 =2;
int led3 =3;
int led4 =4;
int i;
int l=0;
int koha(int n,int m)
{
int q=0;
t:
q=q+1;
digitalWrite(led1 ,LOW);
digitalWrite(led2, LOW);
digitalWrite(led3 ,LOW);\
digitalWrite(led4, LOW);
delay(44000000);
if(q<n)
{
goto t;
}
}
void setup() {
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
pinMode(led3,OUTPUT);
pinMode(led4,OUTPUT);
}
void loop() {
digitalWrite(led1 ,HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3 ,HIGH);
digitalWrite(led4, HIGH);
delay(50);
koha(18,0);
fillimi:
for(i=0;i<109;i++);
{
k:
l=l+1;
digitalWrite(led1 ,HIGH); //6
digitalWrite(led2,LOW);
digitalWrite(led3 ,LOW);
digitalWrite(led4,LOW);
delay(200);
digitalWrite(led1 ,LOW); //5
digitalWrite(led2, HIGH);
digitalWrite(led3 ,LOW);
digitalWrite(led4, LOW);
delay(200);
digitalWrite(led1 ,LOW); //4
digitalWrite(led2, LOW);
digitalWrite(led3 ,HIGH);
digitalWrite(led4, LOW);
delay(200);
digitalWrite(led1 ,LOW);//3
digitalWrite(led2, LOW);
digitalWrite(led3 ,LOW);
digitalWrite(led4, HIGH);
delay(200);
digitalWrite(led1 ,LOW); //2
digitalWrite(led2, LOW);
digitalWrite(led3 ,LOW);
digitalWrite(led4, LOW);
delay(200);
digitalWrite(led1 ,LOW); //1
digitalWrite(led2, LOW);
digitalWrite(led3 ,LOW);
digitalWrite(led4, LOW);
delay(200);
digitalWrite(led1 ,LOW);//3
digitalWrite(led2, LOW);
digitalWrite(led3 ,LOW);
digitalWrite(led4, HIGH);
delay(200);
digitalWrite(led1 ,LOW); //4
digitalWrite(led2, LOW);
digitalWrite(led3 ,HIGH);
digitalWrite(led4, LOW);
delay(200);
digitalWrite(led1 ,LOW); //5
digitalWrite(led2, HIGH);
digitalWrite(led3 ,LOW);
digitalWrite(led4, LOW);
delay(200);
digitalWrite(led1 ,HIGH); //6
digitalWrite(led2,LOW);
digitalWrite(led3 ,LOW);
digitalWrite(led4,LOW);
delay(200);
digitalWrite(led1 ,HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3 ,HIGH);
digitalWrite(led4, HIGH);
delay(500);
if(l<109)
{
goto k;
}
}
koha(80,0);
goto fillimi;
}
int led1 =1;
int led2 =2;
int led3 =3;
int led4 =4;
int i;
int l=0;
int koha(int n,int m)
{
int q=0;
t:
q=q+1;
digitalWrite(led1 ,LOW);
digitalWrite(led2, LOW);
digitalWrite(led3 ,LOW);\
digitalWrite(led4, LOW);
delay(44000000);
if(q<n)
{
goto t;
}
}
void setup() {
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
pinMode(led3,OUTPUT);
pinMode(led4,OUTPUT);
}
void loop() {
digitalWrite(led1 ,HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3 ,HIGH);
digitalWrite(led4, HIGH);
delay(50);
koha(18,0);
fillimi:
for(i=0;i<109;i++);
{
k:
l=l+1;
digitalWrite(led1 ,HIGH); //6
digitalWrite(led2,LOW);
digitalWrite(led3 ,LOW);
digitalWrite(led4,LOW);
delay(200);
digitalWrite(led1 ,LOW); //5
digitalWrite(led2, HIGH);
digitalWrite(led3 ,LOW);
digitalWrite(led4, LOW);
delay(200);
digitalWrite(led1 ,LOW); //4
digitalWrite(led2, LOW);
digitalWrite(led3 ,HIGH);
digitalWrite(led4, LOW);
delay(200);
digitalWrite(led1 ,LOW);//3
digitalWrite(led2, LOW);
digitalWrite(led3 ,LOW);
digitalWrite(led4, HIGH);
delay(200);
digitalWrite(led1 ,LOW); //2
digitalWrite(led2, LOW);
digitalWrite(led3 ,LOW);
digitalWrite(led4, LOW);
delay(200);
digitalWrite(led1 ,LOW); //1
digitalWrite(led2, LOW);
digitalWrite(led3 ,LOW);
digitalWrite(led4, LOW);
delay(200);
digitalWrite(led1 ,LOW);//3
digitalWrite(led2, LOW);
digitalWrite(led3 ,LOW);
digitalWrite(led4, HIGH);
delay(200);
digitalWrite(led1 ,LOW); //4
digitalWrite(led2, LOW);
digitalWrite(led3 ,HIGH);
digitalWrite(led4, LOW);
delay(200);
digitalWrite(led1 ,LOW); //5
digitalWrite(led2, HIGH);
digitalWrite(led3 ,LOW);
digitalWrite(led4, LOW);
delay(200);
digitalWrite(led1 ,HIGH); //6
digitalWrite(led2,LOW);
digitalWrite(led3 ,LOW);
digitalWrite(led4,LOW);
delay(200);
digitalWrite(led1 ,HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3 ,HIGH);
digitalWrite(led4, HIGH);
delay(500);
if(l<109)
{
goto k;
}
}
koha(80,0);
goto fillimi;
}
No comments:
Post a Comment