RF receiver for integer only, how to cast uint8_t to int? I'm using the RadioHead library with ASK Driver to transmit/receive data with generic RF modules. It works fine, but I'm lacking some knowledge in programming the code to use the data received. Most examples I could find show how to send a string, but I only need to send and receive an integer.

I'm sending the decimal value '1' through the transmitter:

    uint8_t *data;
    uint8_t value;

    void loop() {
    value = 1;
    data = &amp;value;
    driver.send(data, sizeof(value));
    driver.waitPacketSent();
    delay(200);
    }


And I have in the receiver:

void loop() {
  uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
  uint8_t buflen = sizeof(buf);
  int value;

  if (driver.recv(buf, &amp;buflen)) {
    driver.printBuffer("Received:", buf, buflen); //prints 1.
    value = (int) buf; //my attempt to cast
    Serial.println(value); // the output is 2233, so this is wrong.
  }
  if (value == 1){ //example
  Serial.println("good");
  }
}


So what I think it is, I'm receiving bytes from the transmitter, which the library function 'driver.printBuffer' reinterprets as decimals and prints the value '1'. But how do I interpret (or cast) this as an integer so I can use it for other things like in the example (If condition) at the end? Any help is very much appreciated. Thanks.
buf is a pointer to the received bytes. Try value = buf[0]; instead.