Convert IR Code to Unsigned Long
hi, hope can help.
i quite new this, gentle! have searched forum can't quite find need.
i using nrf24l01 modules communicate between raspberry pi , arduino uno. that's working fine. have pi sending ir code (0xe0e0f00f - samsung mute in instance), it's broken each individual ascii code , broadcast arduino, receives each code , puts string together. can receive , print can't it!
i using rf24 send ir command. if use ir code directly (without me transmitting in) ie: irsend.sendsamsung(0xe0e0f00f, 32); works fine. but, if use string: irsend.sendsamsung(cmd ,32); get: "error: no matching function call 'irsend::sendsamsung(string&, int)'" - seems expecting 'long unsigned int'.
i have tried can find convert command in long unsigned int , many varieties thereof! please me work out or point me in direction? appreciated.
here full code - it's been cobbled examples , millions of searches!!
i quite new this, gentle! have searched forum can't quite find need.
i using nrf24l01 modules communicate between raspberry pi , arduino uno. that's working fine. have pi sending ir code (0xe0e0f00f - samsung mute in instance), it's broken each individual ascii code , broadcast arduino, receives each code , puts string together. can receive , print can't it!
i using rf24 send ir command. if use ir code directly (without me transmitting in) ie: irsend.sendsamsung(0xe0e0f00f, 32); works fine. but, if use string: irsend.sendsamsung(cmd ,32); get: "error: no matching function call 'irsend::sendsamsung(string&, int)'" - seems expecting 'long unsigned int'.
i have tried can find convert command in long unsigned int , many varieties thereof! please me work out or point me in direction? appreciated.
here full code - it's been cobbled examples , millions of searches!!
code: [select]
#include <spi.h>
#include "rf24.h"
#include <irremote.h>
#include <irremoteint.h>
irsend irsend;
bool radionumber = 0;
rf24 radio(7,8);
byte addresses[][6] = {"1node","2node"};
unsigned long got_code;
string cmd;
char letter;
void setup() {
//led blink
pinmode(9, output);
//set radio
serial.begin(57600);
radio.begin();
radio.setpalevel(rf24_pa_low);
if(radionumber){
radio.openwritingpipe(addresses[1]);
radio.openreadingpipe(1,addresses[0]);
}else{
radio.openwritingpipe(addresses[0]);
radio.openreadingpipe(1,addresses[1]);
}
// start radio listening data
radio.startlistening();
}
void loop() {
//get radio
if( radio.available()){
// variable received timestamp
while (radio.available()) { // while there data ready
radio.read( &got_code, sizeof(unsigned long) );
}
radio.stoplistening();
letter = got_code;
radio.write( &got_code, sizeof(unsigned long) ); // send final 1 back.
radio.startlistening();
//if it's got hash @ end it's end of code
if (got_code != 35){
cmd = cmd + letter;
}
else
{
//blink led
digitalwrite(9, high);
delay(100);
digitalwrite(9, low);
//send command
irsend.sendsamsung(cmd,32);
serial.println(n);\00
cmd = "";
}
//serial.print(f("sent response "));
//serial.println(ltr);
}
} // loop
quote
i have tried can find convert command in long unsigned intthe string class has toint() method stupidly named, since not return int. should @ code see return.
Arduino Forum > Using Arduino > Programming Questions > Convert IR Code to Unsigned Long
arduino
Comments
Post a Comment