#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include <stdint.h>
#include "driver/gpio.h"
//array for all LEDS and pins
int LEDS[8] = {38,37,36,35,0,45,48,47};
//creating the function to turn integer numbers into binary notation using uint8_t
void printbin8(uint8_t valu) {
//printing the integer in binary
printf("The value of %u in binary is: 0b", valu); // Use %u for uint8_t
// Loop through each bit from Most to left which ends at 255
for (int i = 7; i >= 0; i--) {
printf("%d", (valu >> i) & 1); // Shift and mask to get the bit
}
printf("\n"); // adding a new line after every number
}
void app_main() {
//changing the mode to output for the 0-255
for (int i = 7; i >= 0; i--) {
gpio_set_direction(LEDS[i], GPIO_MODE_OUTPUT);
}
uint8_t count = 0; // Initializing count to 0
while (1) {
for (int i = 7; i >= 0; i--) {
//count being the pin level compared to 1 and says yes
gpio_set_level(LEDS[i], (count >> i) & 1);
}
printbin8(count); // Print binary representation of count
vTaskDelay(1000 / portTICK_PERIOD_MS); // Delay for 500 milliseconds
count++; // Increment count
}
}