#include <Arduino.h>
uint32_t combineByteArrayToDecimal(const uint8_t* bytes, size_t length) {
// Initialize the decimal number
uint32_t decimalNumber = 0;
// Iterate over each byte in the array
for (size_t i = 0; i < length; ++i) {
// Shift the previous value of the decimal number by 8 bits and then add the current byte
decimalNumber = (decimalNumber << 8) | bytes[i];
}
// Return the combined decimal number
return decimalNumber;
}
void setup() {
// Initialize serial communication at 9600 bits per second
Serial.begin(9600);
// Example 32-byte array representing a number
uint8_t byteArray[32] = {0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000001, 0b00000000}; // Example data
// Combine the byte array into a decimal number
uint32_t combinedDecimal = combineByteArrayToDecimal(byteArray, sizeof(byteArray));
// Print the combined decimal number
Serial.print("Combined Decimal Number: ");
Serial.println(combinedDecimal);
}
void loop() {
// Nothing to do here
}