I need to send hex string by IR but at firs i need to combine it from 3 variables. So i use string function to merge HEX (1+A+C= 1AC) but problem is that i can't to send string -----> irsend.sendSony(string, 12); IRSend library need to send unsigned long or int. So then i need to convert string to unsigned long code but i don't know how
#include <IRremote.h>
IRsend irsend;
String stringOne;
String stringTwo;
String stringThree;
String string;
unsigned long code;
void setup()
{
Serial.begin(9600);
}
void loop() {
int Team = 1; //in HEX = 1
int Player = 10; //in HEX = A
int Weapon = 12; //in HEX = C
stringOne = String(Team, HEX); //HEX = 1
stringTwo = String(Player, HEX); //HEX = A
stringThree = String(Weapon, HEX); //HEX = C
string = String(stringOne + stringTwo + stringThree); //1 + A + C = 1AC
Serial.println(string); // i get 1AC
//need convert it like this to send it, but i can't
code = string; //????????????
//Because "irsend.sendSony" accept just (unsigned long or int) i can't send string directly
irsend.sendSony(code, 12); // need to send it like this irsend.sendSony(0x1AC, 12);
delay(25);
}
ok, now i understand about HEX, OCTAL, DEC ... but how i can string convert to unsigned long to make IR library understand that i wand send 0x1AC code?