diff options
author | Julian T <julian@jtle.dk> | 2020-02-17 11:06:08 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2020-02-17 11:06:08 +0100 |
commit | 6c92e1fd868a0ad297126cd1a4e797cd572aacef (patch) | |
tree | 3c47336d1e6d4cdd268a11c9ed9969e94e902c27 /sem4 | |
parent | 8076d839bf69e619f2e504122ec2ceb790a0b978 (diff) |
Added solution to emb m4
Diffstat (limited to 'sem4')
-rw-r--r-- | sem4/embedded/emb_m4/emb_m4.ino | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/sem4/embedded/emb_m4/emb_m4.ino b/sem4/embedded/emb_m4/emb_m4.ino new file mode 100644 index 0000000..179f2b6 --- /dev/null +++ b/sem4/embedded/emb_m4/emb_m4.ino @@ -0,0 +1,40 @@ + +#include <krnl.h> +#define STACK 100 + +char stk1[STACK]; +char stk2[STACK]; +struct k_t *tsk1, *tsk2; + +void f1() { + for(;;) { + Serial.println("Haha"); + } +} +void f2() { + bool state = false; + for(;;) { + digitalWrite(13, state); + state = !state; + k_sleep(1000); + } +} + +void setup() +{ + pinMode(13, OUTPUT); + Serial.begin(115200); + Serial.println("Starting"); + + k_init(2, 0, 0); + + tsk1 = k_crt_task(f1, 10, stk1, STACK); + tsk2 = k_crt_task(f2, 10, stk2, STACK); + + k_start(1); +} + +void loop() +{ + +} |