Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theremin device. #27

Open
AlexJenjer opened this issue Nov 17, 2022 · 0 comments
Open

Theremin device. #27

AlexJenjer opened this issue Nov 17, 2022 · 0 comments

Comments

@AlexJenjer
Copy link

Used hoverboard-firmware-hack-FOC. In complete delight. Thanks to the author.
I wanted to have fun with the side boards of the hoverboard. Create a theremin device.
When the board is tilted, it emits a sound of varying frequency.
Instead of LED1, I connected a speaker.
Using the STM32 ST-LINK Utility program, change Option Bytes Protection - Disabled, apply,
then check the box WDG_SW, apply.
The programmer gives errors, but changes the settings.
Download the program from ARM Keil v5.37
Create project, change compiler options c90 to gnu90 , No Warning
Debug Use options: ST-Link Debugger

file config.h
#define VARIANT_HOVERBOARD

file systick.c
// if (SysTick_Config(SystemCoreClock / 1000)){
if (SysTick_Config(SystemCoreClock / 200000)){

file mpu6050.c
// delay_ms(100);
delay_ms(20000);

file gd32f1x0_it.c
void SysTick_Handler(void)
{
tick_count_increment();
delay_decrement();
sound();
}

file util.c
extern MPU_Data mpu;
volatile int32_t x,x1;
void sound2(void) {
mpu_get_data(); x= mpu.euler.pitch >>2; if (x>1000) x=1000;
}
void sound(void) {
x1--; if (x1<1) {x1=x; toggle_led(LED1_GPIO_Port, LED1_Pin);}
}

file main.c
while(1) {
delay_1ms(100);
sound2();

// delay_1ms(DELAY_IN_MAIN_LOOP);

// handle_mpu6050();
// handle_sensors();
// handle_usart();
// handle_leds();
// main_loop_counter++;


Alternatively, you can compile with gcc-arm-none-eabi,
then rename the output file from proj.elf to proj.axf
and substitute in ARM Keil. And from it to load into the controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant