[[2004/A1/練習問題1]]
#define THRESHOLD 40
#define RUN_TIME 150 
#define a 40
#define b 150 
task main ()
{
    SetSensor(SENSOR_1, SENSOR_LIGHT);

    ClearTimer(0);                    

    while ( Timer(0) <= RUN_TIME ) {
        if (SENSOR_1 < THRESHOLD){
    while ( Timer(0) <= b ) {
        if (SENSOR_1 < a){
            OnFwd(OUT_A);
            Off(OUT_C);
        } else {                      
            Off(OUT_A);
            OnFwd(OUT_C);
        }}}



トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS