Prvni ulozeni z chegewara githubu

This commit is contained in:
2023-02-25 16:13:53 +01:00
commit 01eb80dfe2
3279 changed files with 638407 additions and 0 deletions

View File

@ -0,0 +1,27 @@
#include <Arduino.h>
#include <Ticker.h>
// attach a LED to GPIO 21
#define LED_PIN 21
Ticker tickerSetHigh;
Ticker tickerSetLow;
void setPin(int state) {
digitalWrite(LED_PIN, state);
}
void setup() {
pinMode(LED_PIN, OUTPUT);
digitalWrite(1, LOW);
// every 25 ms, call setPin(0)
tickerSetLow.attach_ms(25, setPin, 0);
// every 26 ms, call setPin(1)
tickerSetHigh.attach_ms(26, setPin, 1);
}
void loop() {
}

View File

@ -0,0 +1,42 @@
#include <Arduino.h>
#include <Ticker.h>
// attach a LED to pPIO 21
#define LED_PIN 21
Ticker blinker;
Ticker toggler;
Ticker changer;
float blinkerPace = 0.1; //seconds
const float togglePeriod = 5; //seconds
void change() {
blinkerPace = 0.5;
}
void blink() {
digitalWrite(LED_PIN, !digitalRead(LED_PIN));
}
void toggle() {
static bool isBlinking = false;
if (isBlinking) {
blinker.detach();
isBlinking = false;
}
else {
blinker.attach(blinkerPace, blink);
isBlinking = true;
}
digitalWrite(LED_PIN, LOW); //make sure LED on on after toggling (pin LOW = led ON)
}
void setup() {
pinMode(LED_PIN, OUTPUT);
toggler.attach(togglePeriod, toggle);
changer.once(30, change);
}
void loop() {
}