rosserial working, arduino not outputing
First off, I am Publishing String Data on a "set_pins_mode" topic. When I echo the topic, the data looks like this
---
Data: lights on
When I set up the arduino, everything seems to connect good but I am not getting an output. I believe it may be in the data structure or something. Here is my simplified arduino code.
#include <ros.h>
#include <std_msgs/String.h>
ros::NodeHandle nh;
String Pin;
int Lights = 22;
void messageCb( const std_msgs::String& str_msg){
Pin = str_msg.data;
}
ros::Subscriber(std_msgs::String) sub("set_pins_mode", &messageCb);
void setup(){
pinMode(13, OUTPUT);
nh.initNode();
nh.subscribe(sub);
//Set all the pins we need to output pins
pinMode(Lights, OUTPUT);
}
void loop()
{
if (Pin = "light on"){
digitalWrite(Lights, HIGH);
}
if (Pin = "light off"){
digitalWrite(Lights, LOW);
}
nh.spinOnce();
delay(1);
}
The program will get more complex with more lights added. I wanted to try and get one light working first, then its just a simple thing of copy/paste. I know this has to be easy. The output just doesn't come on.
I've tried to setup Poark but I am getting this error.
/home/octavius/ros_workspace/poark/poark_server/poark_server.cpp:8:29: fatal error: ros/node_handle.h: No such file or directory compilation terminated.