diff --git a/firmware/apps/example_1.c b/firmware/apps/example_1.c new file mode 100644 index 0000000..6b02ee7 --- /dev/null +++ b/firmware/apps/example_1.c @@ -0,0 +1,19 @@ +#include +#include + +// was bedeuten die einzelnen Worte? +// was passiert? +// geht das einfacher? + +static void example(void) { + if(!(PINB & 1)) { + PORTD &= ~(1 << 4); + } + + + if(!(PINB & 2)) { + PORTC &= ~(1 << 2); + } +} + +REG(example); diff --git a/firmware/apps/example_2.c b/firmware/apps/example_2.c new file mode 100644 index 0000000..3a5fabe --- /dev/null +++ b/firmware/apps/example_2.c @@ -0,0 +1,18 @@ +#include +#include + +// was erwartest du das passiert? +// wie kann man das Problem lösen? + +static void example(void) { + if(button_state(LEFT)) { + led_inv(LEFT); + } + + + if(button_state(RIGHT)) { + motor_inv(); + } +} + +REG(example); diff --git a/firmware/apps/example_3.c b/firmware/apps/example_3.c new file mode 100644 index 0000000..239a2f2 --- /dev/null +++ b/firmware/apps/example_3.c @@ -0,0 +1,24 @@ +#include +#include +#include + +static void example(void) { + if(button_clicked(LEFT)) { + set_note(NOTE_C, 4); + wait_ms(500); + set_note(NOTE_D, 4); + wait_ms(500); + stop_note(); + } + + + if(button_clicked(RIGHT)) { + set_note(NOTE_D, 4); + wait_ms(500); + set_note(NOTE_C, 4); + wait_ms(500); + stop_note(); + } +} + +REG(example); diff --git a/firmware/apps/example_4.c b/firmware/apps/example_4.c new file mode 100644 index 0000000..d43d2fc --- /dev/null +++ b/firmware/apps/example_4.c @@ -0,0 +1,39 @@ +#include +#include + +// was passiert? +// gibt es probleme? +// wie kann man das problem lösen? + +static void init(void) { + led_on(RIGHT); + led_on(LEFT); +} + +static void example(void) { + led_inv(LEFT); + led_inv(RIGHT); + + wait_ms(500); + + led_inv(LEFT); + + wait_ms(500); + + led_inv(RIGHT); + + wait_ms(500); + + if(button_clicked(LEFT)) { + motor_inv(); + wait_ms(500); + motor_inv(); + wait_ms(500); + motor_inv(); + wait_ms(500); + motor_inv(); + wait_ms(500); + } +} + +REGISTER(example, init, NULL);