I'm trying to control my arduino with a raspberry pi with python instead of C++ (which I don't know). I've found code to take a string from serial and print it, but instead I'd like to use IRsend to use the code. Unfortunately I'm getting the error invalid conversion from 'char*' to 'uint32_t {aka long unsigned int}' [-fpermissive]. I know this must be an incredibly dumb question but is there a int() function for uint32_t for arduino C++? that I could set blah=uint32_t(buf) and then use my irsend.sendNEC(buf, 32)? If it's not painfully obvious, I don't know C++ and my python isn't great.

#include <IRremote.h>

char buf[80];

int readline(int readch, char *buffer, int len) {
  static int pos = 0;
  int rpos;

  if (readch > 0) {
    switch (readch) {
      case '\r': // Ignore CR
      case '\n': // Return on new-line
        rpos = pos;
        pos = 0; // Reset position index ready for next time
        return rpos;
        if (pos < len-1) {
          buffer[pos++] = readch;
          buffer[pos] = 0;
  return 0;

void setup() {

IRsend irsend;

void loop() {
  if (readline(Serial.read(), buf, 80) > 0) {
    Serial.print("You entered: >");
    irsend.sendNEC(buf, 32);


/home/pi/Desktop/sendIRfromserial2addingir/sendIRfromserial2addingir.ino: 39:27: warning: invalid conversion from 'char*' to 'uint32_t {aka long unsigned int}' [-fpermissive]
             irsend.sendNEC(buf, 32);

In file included from

/home/pi/Arduino/libraries/IRremote/src/IRremote.h:444:10: note:   initializing argument 1 of 'void IRsend::sendNEC(uint32_t, uint8_t, bool)'
     void sendNEC(uint32_t data, uint8_t nbits, bool repeat = false);

1 Answer 1


Instead of

irsend.sendNEC(buf, 32);

cast it to an unsigned int32 type:

irsend.sendNEC((uint32_t) buf, 32);
  • 1
    That works! Thank you so much! It's sad how much time I spent looking for an answer. I think it's too simple of a question to have been asked before. Nov 6, 2020 at 1:16
  • Maybe but it's ok ... Welcome anyway, next time also use ctrl-k to align your code and I advise to read a book about C/C++, it will help you greatly using the Arduino. Good luck with your project. Nov 6, 2020 at 1:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.