#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
//declaring the function
void printbin8(uint8_t valu);
void app_main() {
//initializing the unsigned integer ‘count’ to 0
uint8_t count = 0;
while (1) {
// calls the printbin8 function
printbin8(count);
//counts up by one
count++;
vTaskDelay(50 / portTICK_PERIOD_MS); // Delay for 500 milliseconds
}
}
//defining the function
void printbin8(uint8_t valu) {
printf("The value of %u in binary is: 0b", valu); // Use %u for uint8_t
for (int i = 7;i >= 0;i--) {
printf("%i", (valu >> i) & 1);
}
printf("\n");
}