#include <iostream>#include <alproxies/alledsproxy.h>intmain(intargc,char**argv){if(argc<2){std::cerr<<"Usage: leds_ledsfade pIp"<<std::endl;return1;}conststd::stringpIp=argv[1];// Create a proxy to ALLeds.AL::ALLedsProxyleds(pIp);// Example showing how to fade the left eye group to mid-intensitystd::stringname="EarLeds";floatintensity=0.5f;floatduration=1.0f;leds.fade(name,intensity,duration);std::cout<<"Faded "<<name<<" to "<<intensity<<" in "<<duration<<std::endl;return0;}

#! /usr/bin/env python# -*- encoding: UTF-8 -*-"""Example: Use fade Method"""importqiimportargparseimportsysdefmain(session):""" This example uses the fade method. """# Get the service ALLeds.leds_service=session.service("ALLeds")# Example showing how to fade the ears group to mid-intensityname='EarLeds'intensity=0.5duration=1.0leds_service.fade(name,intensity,duration)if__name__=="__main__":parser=argparse.ArgumentParser()parser.add_argument("--ip",type=str,default="127.0.0.1",help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")parser.add_argument("--port",type=int,default=9559,help="Naoqi port number")args=parser.parse_args()session=qi.Session()try:session.connect("tcp://"+args.ip+":"+str(args.port))exceptRuntimeError:print("Can't connect to Naoqi at ip \""+args.ip+"\" on port "+str(args.port)+".\n""Please check your script arguments. Run with -h option for help.")sys.exit(1)main(session)

#include <iostream>#include <alproxies/alledsproxy.h>intmain(intargc,char**argv){if(argc<2){std::cerr<<"Usage: leds_off pIp"<<std::endl;return1;}conststd::stringpIp=argv[1];// Create a proxy to ALLeds.AL::ALLedsProxyleds(pIp);// Example showing how to switch off a groupstd::stringname="FaceLeds";leds.off(name);std::cout<<"LEDs from "<<name<<" group are now off"<<std::endl;return0;}

samples/python/alleds/alleds_off.py

#! /usr/bin/env python# -*- encoding: UTF-8 -*-"""Example: Use off Method"""importqiimportargparseimportsysdefmain(session):""" This example uses the off method. """# Get the service ALLeds.leds_service=session.service("ALLeds")# Example showing how to switch off a groupname='FaceLeds'leds_service.off(name)if__name__=="__main__":parser=argparse.ArgumentParser()parser.add_argument("--ip",type=str,default="127.0.0.1",help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")parser.add_argument("--port",type=int,default=9559,help="Naoqi port number")args=parser.parse_args()session=qi.Session()try:session.connect("tcp://"+args.ip+":"+str(args.port))exceptRuntimeError:print("Can't connect to Naoqi at ip \""+args.ip+"\" on port "+str(args.port)+".\n""Please check your script arguments. Run with -h option for help.")sys.exit(1)main(session)

#include <iostream>#include <alproxies/alledsproxy.h>intmain(intargc,char**argv){if(argc<2){std::cerr<<"Usage: leds_on pIp"<<std::endl;return1;}conststd::stringpIp=argv[1];// Create a proxy to ALLeds.AL::ALLedsProxyleds(pIp);// Example showing how to switch on a groupstd::stringname="FaceLeds";leds.on(name);std::cout<<"LEDs from "<<name<<" group are now on."<<std::endl;return0;}

#! /usr/bin/env python# -*- encoding: UTF-8 -*-"""Example: Use on Method"""importqiimportargparseimportsysdefmain(session):""" This example uses the on method. """# Get the service ALLeds.leds_service=session.service("ALLeds")# Example showing how to switch on a groupname='FaceLeds'leds_service.on(name)if__name__=="__main__":parser=argparse.ArgumentParser()parser.add_argument("--ip",type=str,default="127.0.0.1",help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")parser.add_argument("--port",type=int,default=9559,help="Naoqi port number")args=parser.parse_args()session=qi.Session()try:session.connect("tcp://"+args.ip+":"+str(args.port))exceptRuntimeError:print("Can't connect to Naoqi at ip \""+args.ip+"\" on port "+str(args.port)+".\n""Please check your script arguments. Run with -h option for help.")sys.exit(1)main(session)

#! /usr/bin/env python# -*- encoding: UTF-8 -*-"""Example: Use rasta Method"""importqiimportargparseimportsysdefmain(session):""" This example uses the rasta method. """# Get the service ALLeds.leds_service=session.service("ALLeds")# Example showing a one second rasta animationduration=1.0leds_service.rasta(duration)if__name__=="__main__":parser=argparse.ArgumentParser()parser.add_argument("--ip",type=str,default="127.0.0.1",help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")parser.add_argument("--port",type=int,default=9559,help="Naoqi port number")args=parser.parse_args()session=qi.Session()try:session.connect("tcp://"+args.ip+":"+str(args.port))exceptRuntimeError:print("Can't connect to Naoqi at ip \""+args.ip+"\" on port "+str(args.port)+".\n""Please check your script arguments. Run with -h option for help.")sys.exit(1)main(session)