Created
January 29, 2024 18:00
-
-
Save esmarr58/490e61f8e809fb993b5c161ccb55258a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include "driver/gpio.h" | |
#include "sdkconfig.h" | |
#include <stdbool.h> | |
#include <stdio.h> | |
#define pB7 41 | |
#define pB6 40 | |
#define pB5 39 | |
#define pB4 38 | |
#define pB3 37 | |
#define pB2 36 | |
#define pB1 35 | |
#define pB0 45 | |
void app_main(void){ | |
const uint8_t A = 0b11110000; | |
const uint8_t B = 0b00001111; | |
uint8_t C = A&B; | |
gpio_reset_pin(pB7); | |
gpio_reset_pin(pB6); | |
gpio_reset_pin(pB5); | |
gpio_reset_pin(pB4); | |
gpio_reset_pin(pB3); | |
gpio_reset_pin(pB2); | |
gpio_reset_pin(pB1); | |
gpio_reset_pin(pB0); | |
gpio_set_direction(pB7, GPIO_MODE_OUTPUT); | |
gpio_set_direction(pB6, GPIO_MODE_OUTPUT); | |
gpio_set_direction(pB5, GPIO_MODE_OUTPUT); | |
gpio_set_direction(pB4, GPIO_MODE_OUTPUT); | |
gpio_set_direction(pB3, GPIO_MODE_OUTPUT); | |
gpio_set_direction(pB2, GPIO_MODE_OUTPUT); | |
gpio_set_direction(pB1, GPIO_MODE_OUTPUT); | |
gpio_set_direction(pB0, GPIO_MODE_OUTPUT); | |
while (true) { | |
gpio_set_level(pB7, !((C & 0b10000000) >> 7)); | |
gpio_set_level(pB6, !((C & 0b01000000) >> 6)); | |
gpio_set_level(pB5, !((C & 0b00100000) >> 5)); | |
gpio_set_level(pB4, !((C & 0b00010000) >> 4)); | |
gpio_set_level(pB3, !((C & 0b00001000) >> 3)); | |
gpio_set_level(pB2, !((C & 0b00000100) >> 2)); | |
gpio_set_level(pB1, !((C & 0b00000010) >> 1)); | |
gpio_set_level(pB0, !((C & 0b00000001))); | |
sleep(5); | |
//C = C >> 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment