Skip to content

Instantly share code, notes, and snippets.

View greggjaskiewicz's full-sized avatar
:shipit:
🦸🏼‍♂️

greg jaskiewicz greggjaskiewicz

:shipit:
🦸🏼‍♂️
View GitHub Profile
@greggjaskiewicz
greggjaskiewicz / KittRp2040.cpp
Created September 27, 2022 08:56
Kitt RP2040
// uses my PWM library
#include <stdio.h>
#include <vector>
#include <map>
#include "pico/stdlib.h"
static std::vector<uint8_t> pwmValues;
static std::vector<PiPWM *> pwms;
static int current = 0;
@greggjaskiewicz
greggjaskiewicz / Rp2040PWM.hpp
Created September 27, 2022 07:47
Very simple Rp2040 PWM duty control class
#include "hardware/pwm.h"
class PiPWM {
public:
explicit PiPWM(uint pin);
void start();
void stop();
~PiPWM();
@greggjaskiewicz
greggjaskiewicz / RotaryEncoderOnIRQ.py
Created September 19, 2022 10:16
Rotary Encoder On IRQ RaspberryPi Pico
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
import framebuf
import utime
DT_Pin = Pin(15, Pin.IN)#, Pin.PULL_UP)
CLK_Pin = Pin(14, Pin.IN)#, Pin.PULL_UP)
SW = Pin(2, Pin.IN)#, Pin.PULL_UP)
i2c = I2C(0, scl = Pin(17), sda = Pin(16), freq=400000)
@greggjaskiewicz
greggjaskiewicz / sketch.cpp
Created December 8, 2021 09:47
ESp32 FreeRTOS blinker, v2
const byte ledPins[] = { 15, 2, 0, 4, 5, 18, 19, 21, 22, 23}; // define led pins
const byte chns[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; // define the pwm channels
const int dutys[] = {
1023, 512, 256, 128, 64, 32, 16, 8, 4, 2, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}; //define the pwm dutys
const int delayTimes = 40; //flowing speed ,the smaller, the faster
@greggjaskiewicz
greggjaskiewicz / sketch.cpp
Created December 7, 2021 20:45
ESP32 FreeRTOS blinker
const byte ledPins[] = { 15, 2, 0, 4, 5, 18, 19, 21, 22, 23}; // define led pins
const byte chns[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; // define the pwm channels
const int dutys[] = {
1023, 512, 256, 128, 64, 32, 16, 8, 4, 2, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}; //define the pwm dutys
int ledCounts; //
@greggjaskiewicz
greggjaskiewicz / AtomicPropertyContainers.swift
Created November 25, 2020 13:37
atomic properties in swift.
fileprivate final class ReadWriteLock {
private var rwlock: pthread_rwlock_t = {
var rwlock = pthread_rwlock_t()
pthread_rwlock_init(&rwlock, nil)
return rwlock
}()
func writeLock() {
pthread_rwlock_wrlock(&(self.rwlock))
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <limits>
#include <ArduinoJson.h>
#include <ESP8266HTTPClient.h>
#include <SPI.h>
@greggjaskiewicz
greggjaskiewicz / temperature display wifi bme280 and oled display.cpp
Created September 8, 2020 09:26
temperature display wifi bme280 and oled display
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <limits>
#include <SPI.h>
@greggjaskiewicz
greggjaskiewicz / nodeMCU_BME280_display_wifi.cpp
Created September 6, 2020 13:54
nodeMCU_BME280_display_wifi
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <limits>
#include <SPI.h>
@greggjaskiewicz
greggjaskiewicz / nodeMCU_dht11_display_wifi.cpp
Last active September 6, 2020 12:05
nodeMCU DHT11 display and wifi server
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <limits>
#include <DHT.h>
#include <DHT_U.h>