#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
void app_main() {
uint8_t val = 25; //An unsigned 8-bit integer with a value of 25, which we want to print in binary. (JI)
printf("Binary representation of %d: 0b", val);
// Loop from MSB to LSB to print the numbers in the correct order. (JI)
for (int i = 7; i >= 0; i--) { //For-loop iterates through each bit one at a time. The value (25) is right shifted by 'i' in each loop until all bits have been ANDed with 1, and then the bits are printed. (JI)
printf("%u", (val >> i) & 1);
}
printf("\n"); //For some reason, the code wouldn't print the values using the code above this line. I had to search online for a resolution, and it stated that inserting a print statement at the end can 'flush' the output. (JI)
}