This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "hardware/pwm.h" | |
class PiPWM { | |
public: | |
explicit PiPWM(uint pin); | |
void start(); | |
void stop(); | |
~PiPWM(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; // |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <LiquidCrystal_I2C.h> | |
#include <Wire.h> | |
#include <ESP8266WiFi.h> | |
#include <WiFiClient.h> | |
#include <ESP8266WebServer.h> | |
#include <ESP8266mDNS.h> | |
#include <limits> | |
#include <SPI.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <LiquidCrystal_I2C.h> | |
#include <Wire.h> | |
#include <ESP8266WiFi.h> | |
#include <WiFiClient.h> | |
#include <ESP8266WebServer.h> | |
#include <ESP8266mDNS.h> | |
#include <limits> | |
#include <SPI.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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> |
NewerOlder