mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-05-22 15:39:39 +02:00
39 lines
741 B
C
39 lines
741 B
C
#include <stdio.h>
|
|
#include "pico/stdlib.h"
|
|
#include "servo.h"
|
|
|
|
#define SERVO_GPIO 6
|
|
|
|
int main(void) {
|
|
stdio_init_all();
|
|
|
|
int choice = 1;
|
|
|
|
servo_init(SERVO_GPIO);
|
|
|
|
while (true) {
|
|
if (choice == 1) {
|
|
printf("1\r\n");
|
|
} else if (choice == 2) {
|
|
printf("2\r\n");
|
|
} else {
|
|
printf("?\r\n");
|
|
}
|
|
|
|
switch (choice) {
|
|
case 1:
|
|
printf("one\r\n");
|
|
break;
|
|
case 2:
|
|
printf("two\r\n");
|
|
break;
|
|
default:
|
|
printf("??\r\n");
|
|
}
|
|
|
|
servo_set_angle(0.0f);
|
|
sleep_ms(500);
|
|
servo_set_angle(180.0f);
|
|
sleep_ms(500);
|
|
}
|
|
} |