Code of day #1
//
// everthing you read in GREY is a comment
// the computer ignores it completely
//
//
//
// initialize some stuff.
// define a few variables
// of different types
int age=0;
int pastDays=0;
long myTime=0;
int hourOfDay=0;
//
//
//
// setup and loop MUST be there
void setup(){
}
void loop(){
breath();// will execute everything inside the breath() function
if(pastDays>365){// evaluating how many days have past since last birthday
haveABirthday(); // execute whatever is in the haveABirthday() function
}
pastDays=pastDays+1;// add one to the pastDays variable (increase it)
if(hourOfDay==8){// check if the hour of day is...
eat();// execute whatever is in the eat() function
}
if(hourOfDay==13){// check if the hour of day is...
eat();// execute whatever is in the eat() function
}
if(hourOfDay==19){// check if the hour of day is...
eat();// execute whatever is in the eat() function
}
}
//
//
//
// breath is a function()
void breath(){
myTime=millis();
}
// eat is a function()
void eat(){
// make sure very few
//things happen before you eat
}
// haveABirthday is a function()
void haveABirthday(){
age=age+1;
pastDays=0;
}
// tellMyAge is a function()
int tellMyAge(){
return age;
}
April 3rd, 2010 at 16:14
Я извиняюсь, но, по-моему, Вы не правы. Давайте обсудим это. Пишите мне в PM, поговорим….
//
// everthing you read in GREY is a comment
// the computer ignores it completely
//
//
//
// initialize some stuff…..
April 21st, 2010 at 10:49
Вы ошиблись, это очевидно….
//
// everthing you read in GREY is a comment
// the computer ignores it completely
//
//
//
// initialize some stuff…..