Skip to content

Theremin device. #27

@AlexJenjer

Description

@AlexJenjer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions