2006a/C2/LightProgram2
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[2006a/C2/課題3右]]
written by itos
*Program no.2 [#n46127a8]
This program is made as the second program of the c2-R gr...
*Function of this program [#g01dd22b]
**The machine can trace such strong light as that of a fl...
The machine uses two light sensors, which are set light a...
And the two sensors sense the lightness of the surroundin...
If the lightness of the right side is stronger than that ...
And vise versa.
The machine repeat this choice and movement again and aga...
**The machine can search strong light when it lose sight ...
If the lightness two both light sensors sense is under 33...
Then the machine return to the strongest way and go strai...
(The value '33' was not found instantly. We two experime...
**The machine can ring the sound. [#y491ab3d]
When the machine goes around to search, sound rings.
Plus, this sound is decided by the lightness of the front...
I tried this once, but no sound was heard.
So we thought for a long time and found that the sound wa...
As a solution of this problem, we decided to use around t...
**Other Points [#p25b446c]
When I use this program for the machine, I change the pla...
I place them so that they can sense the light only from t...
To be concrete, I turned the right sensor to right and le...
Thanks to this invention, the tracing of the machine beca...
*This is the PROGRAM! [#v193a955]
#define THRESHOLD 40 // Decision Standard
#define ROUND 20 // Round Standard
#define DECIDEBORDER 33 // The border value to de...
#define AROUND_TIME 210 // The time the machine t...
int light_strongest ;
int time_strongest ;
int sound_height ;
task playsound()
{
while (true)
{
PlayTone( 3000 - (2000 * sound_height /100) , 100);...
}
}
task main ()
{
SetSensor(SENSOR_1, SENSOR_LIGHT);
SetSensor(SENSOR_3, SENSOR_LIGHT);
OnFwd(OUT_A+OUT_C);
light_strongest = SENSOR_1;
while (true) {
if (SENSOR_1 < THRESHOLD && ( SENSOR_1 > DECIDEBO...
Rev(OUT_A);
until(SENSOR_1 > THRESHOLD);
Fwd(OUT_A);
}
if (SENSOR_3 < THRESHOLD && ( SENSOR_1 > DECIDEBO...
Rev(OUT_C);
until(SENSOR_3 > THRESHOLD);
Fwd(OUT_C);
}
if (SENSOR_1 < DECIDEBORDER && SENSOR_2 < DECIDEB...
{ ...
sound_height = SENSOR_3; // S...
start playsound ;
ClearTimer(0);
OnFwd(OUT_A);
OnRev(OUT_C);
while(FastTimer(0) < AROUND_TIME)
{
if(SENSOR_1>light_strongest)
{
light_strongest = SENSOR_1;
time_strongest = FastTimer(0);
}
}
OnFwd(OUT_C);
OnRev(OUT_A);
Wait( AROUND_TIME - time_strongest );
stop playsound ;
Fwd(OUT_A);
}
}
}
*Please give us any comment, wheter it is good or bad. [#...
#comment
終了行:
[[2006a/C2/課題3右]]
written by itos
*Program no.2 [#n46127a8]
This program is made as the second program of the c2-R gr...
*Function of this program [#g01dd22b]
**The machine can trace such strong light as that of a fl...
The machine uses two light sensors, which are set light a...
And the two sensors sense the lightness of the surroundin...
If the lightness of the right side is stronger than that ...
And vise versa.
The machine repeat this choice and movement again and aga...
**The machine can search strong light when it lose sight ...
If the lightness two both light sensors sense is under 33...
Then the machine return to the strongest way and go strai...
(The value '33' was not found instantly. We two experime...
**The machine can ring the sound. [#y491ab3d]
When the machine goes around to search, sound rings.
Plus, this sound is decided by the lightness of the front...
I tried this once, but no sound was heard.
So we thought for a long time and found that the sound wa...
As a solution of this problem, we decided to use around t...
**Other Points [#p25b446c]
When I use this program for the machine, I change the pla...
I place them so that they can sense the light only from t...
To be concrete, I turned the right sensor to right and le...
Thanks to this invention, the tracing of the machine beca...
*This is the PROGRAM! [#v193a955]
#define THRESHOLD 40 // Decision Standard
#define ROUND 20 // Round Standard
#define DECIDEBORDER 33 // The border value to de...
#define AROUND_TIME 210 // The time the machine t...
int light_strongest ;
int time_strongest ;
int sound_height ;
task playsound()
{
while (true)
{
PlayTone( 3000 - (2000 * sound_height /100) , 100);...
}
}
task main ()
{
SetSensor(SENSOR_1, SENSOR_LIGHT);
SetSensor(SENSOR_3, SENSOR_LIGHT);
OnFwd(OUT_A+OUT_C);
light_strongest = SENSOR_1;
while (true) {
if (SENSOR_1 < THRESHOLD && ( SENSOR_1 > DECIDEBO...
Rev(OUT_A);
until(SENSOR_1 > THRESHOLD);
Fwd(OUT_A);
}
if (SENSOR_3 < THRESHOLD && ( SENSOR_1 > DECIDEBO...
Rev(OUT_C);
until(SENSOR_3 > THRESHOLD);
Fwd(OUT_C);
}
if (SENSOR_1 < DECIDEBORDER && SENSOR_2 < DECIDEB...
{ ...
sound_height = SENSOR_3; // S...
start playsound ;
ClearTimer(0);
OnFwd(OUT_A);
OnRev(OUT_C);
while(FastTimer(0) < AROUND_TIME)
{
if(SENSOR_1>light_strongest)
{
light_strongest = SENSOR_1;
time_strongest = FastTimer(0);
}
}
OnFwd(OUT_C);
OnRev(OUT_A);
Wait( AROUND_TIME - time_strongest );
stop playsound ;
Fwd(OUT_A);
}
}
}
*Please give us any comment, wheter it is good or bad. [#...
#comment
ページ名: