Luka Danilovic / Mbed 2 deprecated LED_test

Dependencies:   mbed ros_lib_kinetic_led PololuLedStrip

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers led.h Source File

led.h

00001 #ifndef __LED_H__ //Inclusion safeguards
00002 #define __LED_H__ //Definition of the inclusion
00003 /*============================================================================*/
00004 
00005 /* Libraries */
00006 #include "mbed.h"
00007 #include "PololuLedStrip.h"
00008 #include <string>
00009 #include <ros.h>
00010 #include <std_msgs/String.h>
00011 #include <geometry_msgs/Twist.h>
00012 
00013 /* Definitions */
00014 #define LED_COUNT 30
00015 #define LED_F_PIN PC_9  
00016 #define LED_B_PIN PC_8
00017 #define MaxVelocity 0.5f
00018 
00019 
00020 /* Declarations */
00021 extern rgb_color colors[];
00022 int LEDBrightness;
00023 float led_tmp;
00024 int led_num;
00025 
00026 extern string audio_state;
00027 extern float vel;
00028 extern float ang;
00029 
00030 
00031 /* Instantiations */
00032 PololuLedStrip ledStripFront(LED_F_PIN);
00033 PololuLedStrip ledStripBack(LED_B_PIN);
00034 ros::NodeHandle nh;
00035 std_msgs::String status_msg;
00036 ros::Publisher status_pub("status", &status_msg); 
00037 ros::Subscriber<std_msgs::String> AudioStatus("audio_status", &AudioStatusCB);
00038 ros::Subscriber<geometry_msgs::Twist> cmd_vel_sub("cmd_vel", &cmdVelCB);
00039 
00040 /* Function Prototypes */
00041 void AudioStatusCB(const std_msgs::String &status);
00042 void cmdVelCB(const geometry_msgs::Twist &twist);
00043 float Map(float x, float in_min, float in_max, float out_min, float out_max);
00044 
00045 /*============================================================================*/
00046 #endif // End of inclusion