add function for random sequence generation

main
rkcf 2023-01-27 14:39:01 -06:00
parent 3fe135db8f
commit c562d43cec
1 changed files with 9 additions and 0 deletions

View File

@ -1,6 +1,8 @@
#include <stdio.h>
#include <stdint.h>
#include <esp_random.h>
#define SEQ_MAX_LEN 8
@ -12,6 +14,11 @@
// CV Out
// Gate Out
void gen_rand_seq(uint8_t *sequence) {
for (uint8_t i = 0; i < SEQ_MAX_LEN; i++) {
sequence[i] = esp_random() % 2;
}
}
void app_main(void)
{
@ -24,6 +31,8 @@ void app_main(void)
for (uint8_t step = 0; step < seq_len; step++) {
printf("%i", sequence[step]);
}
gen_rand_seq(sequence);
printf("\n");
}
}