Golang and Arduino

Small arduino and golang programs

Make a simple scheduler for arduino

After some googling, i decided to try to write and arduino library to simplify use of "millis" trick to schedule jobs with 'clean api'.

Here is some code of blink:


#include "SimpleScheduler.h"

void ledOn();
void ledOff();

void ledOn() {
  digitalWrite(LED_BUILTIN, HIGH);
  schedule(500, ledOff);
}
void ledOff() {
  digitalWrite(LED_BUILTIN, LOW);
  schedule(500, ledOn);
}

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  ledOn();
}

void loop() {
  scheduler_run();
}

you can find library at github arduino SimpleScheduler

July 3, 2020