Commit 73b35e21 authored by Lisa Marie Dreier's avatar Lisa Marie Dreier
Browse files

Simulate spring

parent 7e02eb84
......@@ -133,6 +133,7 @@ SET(SRC_LIST
src/DCMotor.cpp
src/ExternButton.cpp
src/ServoMotor.cpp
src/adc.cpp
${LIBEZS_SOURCES}
)
......
......@@ -25,14 +25,16 @@ extern uint32_t SystemCoreClock;
void test_init() {
clock_setup();
adc_setup();
ezs_printf("\n================================\n\n");
ezs_printf("Start Init\n");
clock_setup();
ezs_printf("Clock loaded\n");
adc_setup();
ezs_printf("ADC loaded\n");
uint8_t errno_gyro = BSP_GYRO_Init();
if (errno_gyro != GYRO_OK) {
ezs_printf("Gyro Error!\n");
......@@ -56,6 +58,9 @@ void test_init() {
dc_init();
ezs_printf("DC loaded\n");
button_init();
ezs_printf("Extern Button loaded\n");
ezs_printf("Finish Init\n");
ezs_printf("\n================================\n\n");
}
......@@ -114,9 +119,22 @@ void get_degree() {
void test_thread(cyg_addrword_t arg) {
test_init();
button_init();
while (1) {
uint16_t input_adc = read_adc_naiive(11);
ezs_printf("ADC: %5d ", input_adc);
if (input_adc < 500 || input_adc > 3500) {
ezs_printf("Speed: %3d\n", 0);
dc_set(0, 0);
}
else {
uint8_t speed = input_adc / 4096.0 * 125;
ezs_printf("Speed: %3d\n", speed);
dc_set(DC_LEFT, speed);
}
}
int i = 0;
/*int i = 0;
while (!BSP_PB_GetState(BUTTON_KEY)) {
for (i = 0; i < 255; i += 5) {
ezs_printf("Iteration up: %d\n", i);
......@@ -140,7 +158,7 @@ void test_thread(cyg_addrword_t arg) {
uint16_t input_adc = read_adc_naiive(11);
ezs_printf("adc: %d\n", input_adc);
}
}
}*/
}
void cyg_user_start(void) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment