blink1_example.cpp
Go to the documentation of this file.
00001 /*
00002 * Copyright (c) 2016 Carnegie Mellon University, Guilherme Pereira <gpereira@cmu.edu>
00003 *
00004 * For License information please see the LICENSE file in the root directory.
00005 *
00006 */
00007 
00008 #include "blink1/Blink1.h"
00009 
00010 int main(int argc, char **argv)
00011 {
00012   ros::init(argc, argv, "test_blink");
00013  
00014   ros::NodeHandle n;
00015   
00016   Blink1* led;
00017   led=new Blink1(n);
00018   
00019   while (ros::ok())
00020   {
00021        ros::spinOnce();
00022        
00023        led->fade(255, 0, 0, 500);     // fade led to red in 500 miliseconds
00024        ros::Duration(5).sleep();
00025        led->fade(0, 255, 0, 300);     // fade green to red in 300 miliseconds
00026        ros::Duration(5).sleep();
00027        led->set(0, 0, 255);         // set led to blue imediatelly
00028        ros::Duration(5).sleep();
00029        
00030        led->blink(400);             // blink with randon colors with period 400 miliseconds
00031        ros::Duration(10).sleep();
00032               
00033        led->blink(255, 0, 0, 800);  // blink red colors at frequency 800 miliseconds
00034        ros::Duration(5).sleep();
00035        
00036        led->fade(255, 255, 255, 500);  // fade to white in 500 miliseconds
00037        ros::Duration(10).sleep();
00038        
00039   }
00040   
00041 
00042   return 0;
00043 }


blink1
Author(s): Guilherme Pereira (The AIR lab, Carnegie Mellon University)
autogenerated on Sat Jun 8 2019 20:13:43