Converting bytes to other data types

I am running this code :

#include <SoftwareSerial.h>
SoftwareSerial Rx(A5, A4);

int number =0;
int incomingByte = 0;   // for incoming serial data

void setup() {
        Rx.begin(4800);
        Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
}

void loop() {

        // send data only when you receive data:
        if (Rx.available() > 0) {
                // read the incoming byte:
                incomingByte = Rx.read();

                
                // say what you got:
                Serial.print("I received: ");
                Serial.println(incomingByte);
                if(incomingByte==49){
                  Serial.print("1");
                }
              //  Rx.print(incomingByte);
        }
}

I can receive a byte of data and print it, and the IF statement is recognising this byte and prints the corresponding number,
In stead of write a whole load of if statements for my project I would like to know how to convert the byte back to the ascii version .

I don't understand completly your question. For conversion to ASCII there are bunch of functions in C. If you want to print data like 0,1..255 to ASCII just to do this Rx.print(incomingByte);.

Hi spruce_m00se

if(incomingByte==49){
                  Serial.print("1");

To print the character that corresponds to a particular ASCII value, just use this:

Serial.write(incomingByte);

Regards

Ray

thanks works well