• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_light函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中set_light函数的典型用法代码示例。如果您正苦于以下问题:C++ set_light函数的具体用法?C++ set_light怎么用?C++ set_light使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了set_light函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: update_light

// *************************************************************************************************
// @fn          update_light
// @brief       Update light status 
// @param       none
// @return      none
// *************************************************************************************************
void update_light(void)
{
	if(!sys.flag.low_battery && light.value >= LIGHT_LEVEL)
	{
		// Config front light duty cicle and blink rate
		light.front_blink = 6;
		light.front_duty = 10;
		
		// Enable front light Timer
		light.front_enable = TRUE;
		Timer0_A1_Start();
		
		// Enable back light Timer
		light.back_enable = TRUE;
		Timer0_A2_Start(); 
	
		// Turn on lights
		set_light(LIGHT_ALL, LIGHT_ON);
	}
	else
	{
		// Disable front light Timer
		light.front_enable = FALSE;
		Timer0_A1_Stop();
		
		// Disable back light Timer
		light.back_enable = FALSE;
		Timer0_A2_Stop(); 
		
		// Turn off lights
		set_light(LIGHT_ALL, LIGHT_OFF);
	}
}
开发者ID:alkin,项目名称:tidecc,代码行数:39,代码来源:light.c


示例2: autobaud

int autobaud(int port) {
  int lighton=0;
  int leastErrors=99999;
  int leastBaud=-1;
  unsigned int chars,errors;
  for(int i=0;i<STANDARD_BAUD_NUM;i++) {
    lighton=1-lighton;
    set_light(port,lighton);
    int result=countCharBaud(port,standardBaud[i],&chars,&errors);
    if(result>0) {
      baud[port]=standardBaud[i];
      set_light(port,OFF);
      return result;
    }
  	if(result==-2) {
	    if(errors<(chars/10) && errors<leastErrors) {
	      leastErrors=errors;
        leastBaud=i;
      }
	  }
	  drainToSD(&uartbuf[port]);
  }
  //No spped was perfect, use the best speed
  if(leastBaud>=0) {
    baud[port]=standardBaud[leastBaud];
	set_light(port,OFF);
	return 2;
  }
  //No speed was close enough, don't use the port
  uartMode[port]=PKT_NONE;
  baud[port]=0;
  set_light(port,OFF);
  return -1;
}
开发者ID:kwan3217,项目名称:Loginator,代码行数:34,代码来源:uart.c


示例3: pinModeFast

void hexbright::init_hardware() {
  // These next 8 commands are for reference and cost nothing,
  //  as we are initializing the values to their default state.
  pinModeFast(DPIN_PWR, OUTPUT);
  digitalWriteFast(DPIN_PWR, LOW);
  pinModeFast(DPIN_RLED_SW, INPUT);
  pinModeFast(DPIN_GLED, OUTPUT);
  pinModeFast(DPIN_DRV_MODE, OUTPUT);
  pinModeFast(DPIN_DRV_EN, OUTPUT);
  digitalWriteFast(DPIN_DRV_MODE, LOW);
  digitalWriteFast(DPIN_DRV_EN, LOW);
  
#if (DEBUG!=DEBUG_OFF)
  // Initialize serial busses
  Serial.begin(9600);
  Wire.begin();
  Serial.println("DEBUG MODE ON");
#endif
#if (DEBUG!=DEBUG_OFF && DEBUG!=DEBUG_PRINT)
  if(DEBUG==DEBUG_LIGHT) {
    // do a full light range sweep, (printing all light intensity info)
    set_light(0,1000,update_delay*1002);
  } else if (DEBUG==DEBUG_TEMP) {
    set_light(0, MAX_LEVEL, NOW);
  } else if (DEBUG==DEBUG_LOOP) {
    // note the use of TIME_MS/update_delay.
    set_light(0, MAX_LEVEL, 2500/update_delay);
  }
  
#ifdef FREE_RAM
  Serial.print("Ram available: ");
  Serial.print(freeRam());
  Serial.println("/1024 bytes");
#endif
#ifdef FLASH_CHECKSUM
  Serial.print("Flash checksum: ");
  Serial.println(flash_checksum());
#endif

#endif // DEBUG!=DEBUG_OFF
  
#ifdef ACCELEROMETER
  enable_accelerometer();
#endif
  
  // was this power on from battery? if so, it was a button press, even if it was too fast to register.
  read_charge_state();
  if(get_charge_state()==BATTERY)
    press_button();
  
  continue_time = micros();
}
开发者ID:bhimoff,项目名称:hexbright,代码行数:52,代码来源:hexbright.cpp


示例4: check_ball

int check_ball(uint32_t d, uint32_t t){
	int found = 0; 
	set_light(LIT_LEFT, LIT_OFF);
	if(d < WALL){ 
		if( d < min.d){
			min.d = d;
			min.t = t;
			printf("Distance: %d Angle: %d NEW MIN!\n", d);
			set_light(LIT_LEFT, LIT_RED);
			found = 1;
		}
	}
	return found;
}
开发者ID:marc0l92,项目名称:Madara_ev3_OSProject,代码行数:14,代码来源:bt_main7.c


示例5: blinklock

void blinklock(int maintainWatchdog, int blinkcode) {
  if(blinkcode==0) {
    for(;;) {
      set_light(0,ON);
      delay_ms(50);
      set_light(0,OFF);
      set_light(1,ON);
      delay_ms(50);
      set_light(1,OFF);
    }
  } else {
    for(;;) {
      for(int i=0;i<blinkcode;i++) {
        set_light(0,ON);
        delay_ms(250);
        set_light(0,OFF);
        delay_ms(250);
      }
      set_light(1,ON);
      delay_ms(250);
      set_light(1,OFF);
      delay_ms(250);
    }
  }
}
开发者ID:rghunter,项目名称:LoggoDAQ,代码行数:25,代码来源:main.c


示例6: error_message

void error_message(char *message){
	printf("%s", message);
	fflush(stdout);
	ev3_clear_lcd();
	ev3_text_lcd_normal(0,0, message);
	while(1){
		set_light(LIT_RIGHT, LIT_RED);
		set_light(LIT_LEFT, LIT_OFF);
		sleep(1);
		set_light(LIT_RIGHT, LIT_OFF);
		set_light(LIT_LEFT, LIT_RED);
		sleep(1);
	}
}
开发者ID:marc0l92,项目名称:Madara_ev3_OSProject,代码行数:14,代码来源:ev3lib_gui.c


示例7: pinModeFast

void hexbright::init_hardware() {
  // We just powered on! That means either we got plugged
  // into USB, or the user is pressing the power button.
  pinModeFast(DPIN_PWR, INPUT);
  digitalWriteFast(DPIN_PWR, LOW);
  // Initialize GPIO
  pinModeFast(DPIN_RLED_SW, INPUT);
  pinModeFast(DPIN_GLED, OUTPUT);
  pinModeFast(DPIN_DRV_MODE, OUTPUT);
  pinModeFast(DPIN_DRV_EN, OUTPUT);
  digitalWriteFast(DPIN_DRV_MODE, LOW);
  digitalWriteFast(DPIN_DRV_EN, LOW);
  
#if (DEBUG!=DEBUG_OFF)
  // Initialize serial busses
  Serial.begin(9600);
  Wire.begin();
  Serial.println("DEBUG MODE ON");
#endif
#if (DEBUG!=DEBUG_OFF && DEBUG!=DEBUG_PRINT)
  if(DEBUG==DEBUG_LIGHT) {
    // do a full light range sweep, (printing all light intensity info)
    set_light(0,1000,update_delay*1002);
  } else if (DEBUG==DEBUG_TEMP) {
    set_light(0, MAX_LEVEL, NOW);
  } else if (DEBUG==DEBUG_LOOP) {
    // note the use of TIME_MS/update_delay.
    set_light(0, MAX_LEVEL, 2500/update_delay);
  }
  
#ifdef FREE_RAM
  Serial.print("Ram available: ");
  Serial.print(freeRam());
  Serial.println("/1024 bytes");
#endif
#ifdef FLASH_CHECKSUM
  Serial.print("Flash checksum: ");
  Serial.println(flash_checksum());
#endif

#endif // DEBUG!=DEBUG_OFF
  
#ifdef ACCELEROMETER
  enable_accelerometer();
#endif
  
  continue_time = micros();
}
开发者ID:Bonculus13,项目名称:hexbright,代码行数:48,代码来源:hexbright.cpp


示例8: setup

void setup() {
  set_short("Xrazzicaz' Boot Camp");
  add_property("determinate", "");
  set_light( 75 );
  add_property("no teleport", 1);
  
  set_long("This is a small training room, designed to help the new "
           "adventurer get off to a good start on Discworld.  The air is "
           "stale with the combined stench of sweat, beer, and old "
           "warriors.  Off to one side is a rather unusual training "
           "dummy above which is a small plaque.\n");
  add_item( "face", "As you stare at it, squinting and turning your head "
            "side to side, you realise it looks rather like your old maths "
            "teacher!\n");
  add_item( "floor", "The floor is made of flagstones, cemented together "
            "with centuries of accumulated muck.\n");
  add_item( "wall", "The walls are marked with mysterious stains that may or "
            "may not be blood.  But surely training dummies don't bleed.\n");
  add_item( "ceiling", "The ceiling appears to be dingy patches of plaster "
            "stuck between old oak rafters that have turned black with "
            "age.\n");
/* Make it so you cannot godmother out of here */
  add_property("no godmother", 1);

  add_exit( "combat", PATH + "combat", "door" );
  add_alias( "southeast", "foyer");
}/*setup*/
开发者ID:Yuffster,项目名称:discworld_distribution_mudlib,代码行数:27,代码来源:combat_room1.c


示例9: set_uniform_matrix4

        void ForwardPositonalLightShader::update_properties(
                                                            const Mat4& trans,
                                                            const RenderEngine& engine) const
        {
            //TODO remove global camera.
            //                auto mvp =
            
            set_uniform_matrix4("transformation_mat", trans);
//            set_uniform_matrix4("camera_mat", engine.get_global_camera()->get_camera_mat());
//            set_uniform_matrix4("projection_mat", engine.get_global_camera()->get_projection_mat());
            set_uniform_matrix4("camera_mat", Locator::get_game().get_camera()->get_camera_mat());
            set_uniform_matrix4("projection_mat", Locator::get_game().get_camera()->get_projection_mat());

            set_uniform_matrix3("normal_mat",  trans.get_mat3().inverse().transpose());
            
            
            
            set_light("positional_light.light", engine.get_active_light());
            
            set_pos_light("positional_light",static_cast<const PositionalLight*>(engine.get_active_light()),trans);
            

//            
            //TODO 
            set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos());
            set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos());
            
            set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos());
            set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos());
//            //use the new texture
//            material.get_texture("diffuse").bind_texture(m_program_id, m_uniform_map["texture_sampler"]);
        }
开发者ID:BeiLuoShiMen,项目名称:NicoEngine,代码行数:32,代码来源:FowardPosLightShader.cpp


示例10: setup

void setup() {
   set_short( "uninitialised search room" );
   set_long( "You are in an uninitialized search room.  "
            "This is an example of a room that gets cloned and configured "
            "afterwards.  In this room, it's the function set_marker that's " 
            "used to define its look, and most if the exits as well.  And "
            "the function set_destination that is used to find, possibly "
            "clone and configure, the rooms that fit the keywords you search "
            "for.  The handler called SEARCH in the code, is \""+
            SEARCH +"\" and the one called QUIT_HANDLER, is \""+ 
            QUIT_HANDLER +"\".\n" );
   add_property( "no map", 1 );
   /* set_light sets the amount of light the room has.  See help light
    * for a list of what the number means:)
    */
   set_light( 50 );

   add_exit( "exit", LEARNING +"search", "path" );
   /* add_property is used to add a value to an object, that can later be
    * queried for with query_property.
    * The "commented functions" and "keywords" properties are specific for 
    * rooms in the learning domain and is used to make it possible to search
    * for subjects. 
    * See /d/learning/handlers/search.c for the way this is done.
    */
   add_property( "commented functions", 
                ({ "set_destination", "query_quit_handler", 
                   "query_cloning_info" }) );
开发者ID:Yuffster,项目名称:discworld_distribution_mudlib,代码行数:28,代码来源:search_room.c


示例11: create

create() {
    set_short("Winding Path");
 
    set_long("\
This is a winding, thickly wooded path winding east and west through the\n\
the Forest of Elwoode.  The thick canopy of leaves overhead shelters the\n\
trail almost completely from the elements.  An opening in the vegetation\n\
lies to the north.\n");
 
    add_exit(ROOMS+"garg001", "north");
    /* what the fuck is this? COMMENT any changes, dammit!  - Slider 2/16/2000 */
	// Sorry Slider, the exit was mine to lead to Barrowmere. - Frij
	add_exit("/room/circ/roads/west1b","south");
    add_exit(ROOMS+"path4", "west");
    add_exit(ROOMS+"path2", "east");
 
    add_item("leaves",
"The cool, fragrant leaves protect the path from the elements.\n");
 
    add_item("path",
"The force of many feet through the ages has etched this path deeply into\n\
the earth.  You wonder where it leads.....\n");
 
    add_item("opening",
"It looks dangerous.  You feel a cautious sort of dread as you consider \n\
what may be beyond the vegetation.\n");
 
   add_item("vegetation",
"There's an opening in the vegetation that leads north.\n");
 
   set_light(1);
    add_property("outside");  // added by Frijoles
   reset(0);
}
开发者ID:dharmabumstead,项目名称:vrmud,代码行数:34,代码来源:PATH3.C


示例12: setup

void setup() {
  set_short( "bedroom" );
  set_long( "This is a small bedroom above the shop.  There is a window "
            "in the north wall.\n");
  
  set_light( 60 );

  // This is usually calculated for you and only needed if you want the room
  // to be bigger than normal.
  set_room_size( 10 ); 

  // set the movement zone.
  set_zone( "Tiny Town");

  /*
   * lots of add_items are needed here to describe all the things in the
   * room.
   */


  add_exit("window", PATH+"shop-ledge", "window");
  add_exit("down", PATH +"item-shop", "stair" );

  // make them move downwards 9feet when they go down the stairs
  modify_exit("down", ({ "downgrade", 9 }));
开发者ID:Yuffster,项目名称:discworld_distribution_mudlib,代码行数:25,代码来源:shop-upstairs.c


示例13: setup

void setup() {
  set_short("Desert");
  set_long("This is the end of Desert\n");
  set_light( 80 );
  add_exit("east", DESERT + "desert4", "road");
  add_exit("west", DESERT + "desert2", "road");
}
开发者ID:Yuffster,项目名称:discworld_distribution_mudlib,代码行数:7,代码来源:desert3.c


示例14: setup

void setup() {
  set_light(100);
  set_short("Small Gods Street outside Temple");
  set_long(
"You are on Small Gods Street outside the Temple of Small Gods.  "+
"A large gateway to the west leads into the Temple.  The "+
"street continues north and south.\n");
 
  add_exit("north", ROOM+"smallgod1", "road");
  add_exit("south", ROOM+"smallgod3", "road");
  add_exit("west", TEMPLE, "gate");
 
  add_item("temple",
"It is the Temple of Small Gods.  It is covered in small statues.\n");
  add_alias("temple of small gods", "temple");
  add_item("gateway",
"This is a large wrought-iron set of gates which have been open for so many years "+
"that they appear to have rusted permanently open.  Various and sundry "+
"religious symbols are situated over the top of the gateway.\n");
  add_alias("gate", "gateway");
  add_alias("gates", "gateway");
  add_item("symbols", "From the look of it the many different symbols are all "+
"collected from the myriad of small obscure gods that are worshipped "+
"in Ankh-Morpork.\n");
  add_alias("symbol", "symbols");
 
  set_zone("ankh morpork");
 
  set_monster(NUM, "city");
}
开发者ID:quixadhal,项目名称:discworld,代码行数:30,代码来源:smallgod2.c


示例15: reset

reset() {
  set_light(1);
  
  set_emotes(1, ({
	"A carriage barrels through the street causing passerbys to flee.\n",
	"Smoke wafts through on the back of a short gust from a nearby hearth.\n",
  }));
开发者ID:psychoza,项目名称:WAR,代码行数:7,代码来源:telrasnia_city_env.c


示例16: setup

void setup() {
  // make sure that the short says "A simple item shop" rather than "The ..."
  add_property( "determinate", "A " );
  
  set_short( "simple item shop" );
  set_long( "This is a nice looking shop.  Obviously your shop would have "
            "a much more interesting description.\n");
  
  set_light( 60 );

  // This is usually calculated for you and only needed if you want the room
  // to be bigger than normal.
  set_room_size( 10 ); 

  // set the movement zone.
  set_zone( "Tiny Town");

  add_exit( "north", TTOWNROADS +"womble01", "door" );
  modify_exit( "nouth", ({
    "exit mess", "Chimes start playing as $N "
      "leave$s through the north door.",
      "enter mess", ({ 
        1,
          "$N enters from the south.",
          "$N enter from the south." }),
      "move mess", "Chimes start playing as you leave the shop.\n"
      }));
开发者ID:Yuffster,项目名称:discworld_distribution_mudlib,代码行数:27,代码来源:item-shop.c


示例17: setup

void setup() {
  set_short("Plains");
  set_long("This is the end of Plains\n");
  set_light( 80 );
  add_exit("east", PLAIN + "plain5", "road");
  add_exit("west", PLAIN + "plain3", "road");
}
开发者ID:Yuffster,项目名称:discworld_distribution_mudlib,代码行数:7,代码来源:plain4.c


示例18: setup

void setup() {
   set_short("add_item room #4, many verbs ");
   set_light(100);

   set_long( "add_item room #4, many verbs \n"
            "Sometimes you have two or more identical verbs - or at least "
            "identical in how you want to treat them.  Take our oak tree "
            "we can cut it, slice it, saw it, etc...  Now all of these have "
            "the same meaning. How do we do this?\n"
            "A large oak.\nA note.\n");
   
   add_item("note", ({ "long", "It can be read.",
      "read", "Here is the code for the tree:\n"
      "    add_item(\"large oak tree\", ({\n"
      "      \"long\",\n"
      "              \"It looks like it is very well protected.\"\n"
      "      ({\"cut\",\"slice\",\"saw\",\"destroy\",\"kill\" }),\n"
      "              \"It seems to have no effect.\\n\"       }});\n\n"
      "Pretty obvious hunh?  Note that kill probably does not work( I "
      "say probably cuz things might change)  That is beacuse user commands "
      "have precidence over object actions in rooms.  Also be aware that a "
      "add_action on an item that a person is holding will most likely stop "
      "your verbs from being used (unless it's coded right:).  Soul commands "
      "do not have precedence, however.  So verbs like \"pick\" which would "
      "normally say \"You pick your nose\" can be trapped appropriately.\n" 
   }) );
开发者ID:Yuffster,项目名称:discworld_distribution_mudlib,代码行数:26,代码来源:many_verbs.c


示例19: setup

void setup() {
//  string *doms, com;
//  int i;
  
  set_light(100);
  set_short("domain-control room");
  add_property("determinate", "the ");
  set_long("You float in nothingness, before a vast turtle, its shell pocked "
    "by asteroid craters. In all directions stars twinkle in the black " 
    "curtain of space.\n" 
"Available commands:\n"
"  list                         : list all domains.\n"
"  list <domain>                : list members of a domain.\n"
"  create <domain>              : create a domain (you are lord).\n"
"  create <domain> <lord>       : create a domain for someone else.\n" 
"  add <creator> <domain>       : add a creator to a domain you own.\n" 
"  delete <creator> <domain>    : remove a creator from a domain you own.\n" 
"  project <cre> <dom> <proj>   : Set the creators project.\n"
"  deputy <cre> <dom>           : Appoint creator as a deputy.\n"
"  undeputy <cre> <dom>         : Remove creator as a deputy.\n"
);

  add_item("turtle", "On its back you can see four elephants, and they bear " +
    "the weight of the disc upon their wide backs.\n");
  add_item("elephants", "The four great elephants labour endlessly in the " +
    "task of turning the disc upon their backs.\n");
  add_item("disc", "The whole discworld, from hub to rim, rides upon the " +
    "elephant's backs.\n");
  add_alias("elephant", "elephants");
  add_exit("north", ROOM+"development", "corridor");
  add_exit("south", ROOM+"site_control", "corridor");
  add_exit("west", ROOM+"access_control", "corridor");
  seteuid("Admin");
} /* setup() */
开发者ID:Yuffster,项目名称:discworld_distribution_mudlib,代码行数:34,代码来源:domain_control.c


示例20: reset

void reset(int arg) {
  if(arg) return;

  set_light(1);
  add_property("hills");

  set_short("Rolling Hills");
  set_long(LB("You stand on the edge of a great land of rolling hills.  "+
	"A wide track winds its way through here, heading south back to "+
	"the lands of men.  The hum of insects is heard in the air, lending "+
	"a natural feel to this otherwise quiet land.  The hills seem "+
	"empty, and a light mist shrouds the distance."));
  add_item("insects", LB("The sound of crickets and cicadas give the "+
	"only signs of activity here."));
  add_item("hills", LB("The hills that surround you are quiet and "+
	"apparently largely uninhabited, except for insects and small "+
	"animals.  The skies are strangely empty of avians, and you "+
	"see no man-made structures around you.  You intuit an unexplained "+
	"spookiness in this forlorn place, however."));
  add_item("track", LB("The dirt track leads back to the village to the "+
	"south.  It is the only safe road into this land, and thus the "+
	"most travelled, but that is only relative."));
  add_item("mist", LB("The mist, which only obscures the distances, "+
	"lends to the loneliness of the land."));
  add_exit("north","hill2");
  add_exit("west", "hill4");
  add_exit("south","track3");
}
开发者ID:nfarrar,项目名称:mudfiles,代码行数:28,代码来源:hill1.c



注:本文中的set_light函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_list函数代码示例发布时间:2022-05-30
下一篇:
C++ set_level函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap