arduino 简易智能花盆

编辑器:arduino IDE

主板:arduino uno

传感器:

0.96寸的OLED屏(四脚)
声音模块
土壤温湿度模块
DS18B20温度模块(这里用到防水的)
光敏电阻模块(买成三脚的了只能显示高低,可换四脚显示数字) 
arduino扩展板 (看个人需求)
杜邦线(母对母,公对母)
 

功能:能在OLED屏上显示出传感器的数据,并模拟显示出植物对应的状态的图案
可自己设置零界点

(买的少的话pdd即可,百元以内轻轻松松,还可以买个wifi模块,做个app上位机)

代码如下:

 

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <SoftwareSerial.h>#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);const int temperatureSensorPin = A0;  // 温度
const int lightSensorDOPin = 7;  // 光敏
const int soilMoistureSensorPin = A2; // 湿度
const int soundSensorPin = A3;  // 声音
OneWire oneWire(A0); // 使用一线式总线连接DS18B20传感器
DallasTemperature sensors(&oneWire);void setup() {Serial.begin(115200);display.begin(SSD1306_SWITCHCAPVCC, 0x3C);display.setTextColor(WHITE);display.clearDisplay();display.display();delay(2000);display.clearDisplay();display.setTextSize(1);display.setTextColor(SSD1306_WHITE);sensors.begin(); // 初始化DS18B20传感器pinMode(soundSensorPin, INPUT); // 初始化声音传感器引脚pinMode(lightSensorDOPin, INPUT);  // 设置数字光敏传感器的数字输出引脚为输入
}static const unsigned char PROGMEM pic[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x40,0x00,
0x00,0x00,0x0F,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,0xE0,0x00,
0x00,0x00,0x7C,0x00,0x00,0x00,0xE0,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF0,0x00,
0x00,0x03,0xF0,0x00,0x00,0x01,0xF0,0x00,0x00,0x07,0xF0,0x00,0x00,0x03,0xF8,0x00,
0x00,0x0F,0xE0,0x00,0x00,0x07,0xF8,0x00,0x00,0x1F,0xE0,0x00,0x00,0xFF,0xFF,0xE0,
0x00,0x3F,0xC0,0x00,0x03,0xFF,0xFF,0xF8,0x00,0x7F,0xC0,0x00,0x01,0xFF,0xFF,0xF0,
0x00,0xFF,0x80,0x00,0x00,0xFF,0xFF,0xE0,0x01,0xFF,0x80,0x00,0x00,0x7F,0xFF,0xC0,
0x01,0xFF,0x80,0x00,0x00,0x3F,0xFF,0x80,0x03,0xFF,0x80,0x00,0x00,0x1F,0xFF,0x00,
0x03,0xFF,0x80,0x00,0x00,0x1F,0xFF,0x00,0x07,0xFF,0x00,0x00,0x00,0x1F,0xFF,0x00,
0x07,0xFF,0x00,0x00,0x00,0x1F,0xFF,0x00,0x0F,0xFF,0x00,0x00,0x00,0x1F,0xFF,0x00,
0x0F,0xFF,0x00,0x00,0x00,0x1F,0xFF,0x00,0x0F,0xFF,0x00,0x00,0x00,0x3F,0x3F,0x00,
0x1F,0xFF,0x00,0x00,0x00,0x3E,0x0F,0x80,0x1F,0xFF,0x80,0x00,0x00,0x38,0x03,0x80,
0x1F,0xFF,0x80,0x00,0x00,0x20,0x00,0x00,0x1F,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,
0x1F,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,
0x1F,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,
0x1F,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,
0x1F,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,
0x1F,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,
0x1F,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,
0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x08,0x0F,0xFF,0xFF,0x80,0x00,0x00,0x00,0x18,
0x07,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x30,0x07,0xFF,0xFF,0xF0,0x00,0x00,0x00,0xF0,
0x03,0xFF,0xFF,0xF8,0x00,0x00,0x01,0xE0,0x03,0xFF,0xFF,0xFE,0x00,0x00,0x07,0xE0,
0x03,0xFF,0xFF,0xFF,0x80,0x00,0x3F,0xC0,0x01,0xFF,0xFF,0xFF,0xF8,0x01,0xFF,0xC0,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,
0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,
0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xF8,0x00,
0x00,0x07,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x03,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,
0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0x00,0x1F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xF0,0x00,0x00,
0x00,0x00,0x00,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x07,0xF0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};static const unsigned char PROGMEM pic1[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0xC0,0x00,0x00,0x00,
0x00,0x00,0x03,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x07,0xC1,0x80,0x00,0x00,0x00,
0x00,0x00,0x07,0xC3,0x80,0x00,0x00,0x00,0x00,0x00,0x0F,0xC3,0xC0,0x00,0x00,0x00,
0x00,0x00,0x1F,0xC3,0xC0,0x00,0x00,0x00,0x00,0x00,0x1F,0xE3,0xE0,0x00,0x02,0x00,
0x00,0x00,0x1F,0xF1,0xF0,0x00,0x0E,0x00,0x00,0x00,0x1F,0xF8,0xFC,0x00,0x1C,0x00,
0x00,0x00,0x1F,0xF8,0xFE,0x00,0x3C,0x00,0x00,0x00,0x1F,0xFC,0x7F,0x80,0x78,0x00,
0x00,0x00,0x0F,0xFE,0x3F,0xC0,0x78,0x00,0x00,0x00,0x07,0xFE,0x3F,0xF0,0x78,0x00,
0x00,0x00,0x07,0xFE,0x1F,0xF8,0x78,0x00,0x00,0x00,0x03,0xFE,0x1F,0xFC,0x3C,0x00,
0x00,0x00,0x01,0xFE,0x1F,0xFE,0x3C,0x00,0x00,0x00,0x00,0xFE,0x1F,0xFE,0x3C,0x00,
0x00,0x00,0xC0,0x7C,0x1F,0xFE,0x3E,0x00,0x00,0x00,0x40,0x78,0x3F,0xFE,0x3E,0x00,
0x00,0x00,0x60,0x78,0x7F,0xFE,0x3C,0x00,0x00,0x00,0x60,0x70,0xFF,0xFE,0x38,0x00,
0x00,0x00,0x70,0xE3,0xFF,0xFE,0x70,0x00,0x00,0x00,0x70,0xC7,0xFF,0xFC,0xE0,0x00,
0x00,0x00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0x00,0x00,0xFF,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFC,0x00,0x00,
0x00,0x00,0x1F,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xE0,0x00,0x00,
0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};static const unsigned char PROGMEM pic2[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x00,0x00,0x00,
0x00,0x00,0x00,0x07,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF8,0x00,0x00,0x00,
0x00,0x00,0x00,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFC,0x00,0x00,0x00,
0x00,0x00,0x00,0x7F,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0x00,0x00,0x00,
0x00,0x00,0x00,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,0x80,0x00,0x00,
0x00,0x00,0x03,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x03,0xFF,0xFF,0xE0,0x00,0x00,
0x00,0x00,0x07,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xF0,0x00,0x00,
0x00,0x00,0x1F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xF8,0x00,0x00,
0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0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,0x0F,0xF0,0x00,0xFF,0xFF,0xF0,0x00,0x00,0x0F,0xF8,0x00,0xFF,0xFF,0xF0,0x00,
0x00,0x07,0xFC,0x00,0xFF,0xFF,0xE0,0x00,0x00,0x07,0xFF,0x00,0xFF,0xFF,0xE0,0x00,
0x00,0x03,0xFF,0x80,0xFF,0xFF,0xC0,0x00,0x00,0x01,0xFF,0xE0,0xFF,0xFF,0x80,0x00,
0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFE,0x00,0x00,
0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xF8,0x00,0x00,
0x00,0x00,0x07,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x03,0xFF,0xFF,0xC0,0x00,0x00,
0x00,0x00,0x00,0x7F,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};static const unsigned char PROGMEM pic3[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF0,0x00,0x00,
0x00,0x00,0x00,0x00,0x0F,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,
0x00,0x00,0x00,0x00,0x0F,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x07,0x80,
0x00,0x00,0x00,0x18,0x0F,0xF0,0x07,0xC0,0x00,0x00,0x00,0x3C,0x01,0xF8,0x03,0xC0,
0x00,0x00,0x00,0x7E,0x00,0x7E,0x01,0xE0,0x00,0x00,0x00,0x7F,0x00,0x3E,0x01,0xE0,
0x00,0x00,0x00,0xFF,0x80,0x1F,0x00,0xF0,0x00,0x00,0x00,0xFF,0xC0,0x0F,0x80,0xF0,
0x00,0x00,0x01,0xFF,0xE0,0x07,0xC0,0x78,0x00,0x00,0x01,0xFF,0xF0,0x03,0xC0,0x78,
0x00,0x00,0x03,0xFF,0xF8,0x01,0xE0,0x38,0x00,0x00,0x03,0xFF,0xFC,0x01,0xE0,0x38,
0x00,0x00,0x07,0xFF,0xFE,0x00,0xF0,0x3C,0x00,0x00,0x07,0xFF,0xFF,0x00,0xF0,0x3C,
0x00,0x00,0x0F,0xFF,0xFF,0x80,0x70,0x18,0x00,0x00,0x0F,0xFF,0xFF,0xC0,0x60,0x00,
0x00,0x00,0x1F,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xF0,0x00,0x00,
0x00,0x00,0x3F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,
0x00,0x00,0x7F,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xC0,0x00,
0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xC0,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,
0x00,0x03,0xFF,0xFF,0xFF,0xFF,0xC0,0x00,0x00,0x03,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0x07,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0xF0,0x00,0x00,
0x00,0x0F,0xFF,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,
0x00,0x1F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xF0,0x00,0x00,0x00,
0x00,0x3F,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0x00,0x00,0x00,0x00,
0x00,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,
0x07,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,
0x1F,0x1F,0xFF,0x00,0x00,0x00,0x00,0x00,0x1E,0x0F,0xFF,0x80,0x00,0x00,0x00,0x00,
0x1E,0x07,0xFF,0xC0,0x00,0x00,0x00,0x00,0x0F,0x07,0x9F,0xE0,0x00,0x00,0x00,0x00,
0x07,0x8F,0x0F,0xF0,0x00,0x00,0x00,0x00,0x03,0xCF,0x07,0xF8,0x00,0x00,0x00,0x00,
0x01,0xFE,0x03,0xFC,0x00,0x00,0x00,0x00,0x00,0xFC,0x01,0xFC,0x00,0x00,0x00,0x00,
0x00,0x78,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};static const unsigned char PROGMEM pic4[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFE,0x00,0x00,0x00,
0x00,0x00,0x03,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xF8,0x00,0x00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0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xE0,0x00,0x00,
0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xE0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};void loop() {delay(2000);sensors.requestTemperatures();float temperatureC = sensors.getTempCByIndex(0); // 获取DS18B20传感器的温度值int lightIntensity = digitalRead(lightSensorDOPin); // 使用digitalRead读取数字光敏传感器的状态int soilMoisture = analogRead(soilMoistureSensorPin);int soundLevel = analogRead(soundSensorPin);// // 在OLED上显示传感器数据display.clearDisplay();display.setCursor(68, 0);display.print("T: ");display.print(temperatureC);display.print(" C");display.setCursor(68, 10);display.print("L: ");display.print(lightIntensity == LOW ? "High" : "Low"); // 显示光强状态display.setCursor(68, 20);display.print("D: ");display.print(soilMoisture);display.print(" %");display.setCursor(68, 30);display.print("S: ");display.print(soundLevel);display.print(" dB");display.display();// 根据传感器数据选择表情if (lightIntensity == HIGH) {// 低光照强度// display.setCursor(35, 40);// display.clearDisplay();//清屏display.drawBitmap(0, 0, pic, 64, 64, 1); //画出字符对应点阵数据display.setCursor(68, 40);display.print("Sad :(");display.display();//开显示    delay(2000);} else if (temperatureC > 25) {// 高温// display.setCursor(35, 40);// display.clearDisplay();//清屏display.drawBitmap(0, 0, pic1, 64, 64, 1); //画出字符对应点阵数据display.setCursor(68, 40);display.print("Hot :S");display.display();//开显示  delay(2000);} else if (soilMoisture > 500) {// 土壤过干// display.setCursor(35, 40);// display.clearDisplay();//清屏display.drawBitmap(0, 0, pic2, 64, 64, 1); //画出字符对应点阵数据display.setCursor(68, 40);display.print("dry :S");display.display();//开显示delay(2000);} else if (soundLevel > 30) {// 声音强// display.setCursor(35, 40);// display.clearDisplay();//清屏display.drawBitmap(0, 0, pic3, 64, 64, 1); //画出字符对应点阵数据display.setCursor(68, 40);display.print("Loud :O");display.display();//开显示delay(2000);} else {// 默认表情// display.setCursor(35, 40);// display.clearDisplay();//清屏display.drawBitmap(0, 0, pic4, 64, 64, 1); //画出字符对应点阵数据display.setCursor(68, 40);display.print("Smile :)");display.display();//开显示delay(2000);}display.display();
}

 效果如下图:


本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/139408.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

el-table实现展开当前行时收起上一行的功能

<el-tableref"tableRef":data"tableData":expand-row-keys"expandRowKeys":row-key"handleRowKey" // 必须指定 row-keyexpand-change"handleExpandChange" // 当用户对某一行展开或者关闭的时候会触发该事件> <…

【算法专题】双指针—三数之和

力扣题目链接&#xff1a;三数之和 一、题目解析 二、算法原理 解法一&#xff1a;排序暴力枚举利用set去重 代码就不写了&#xff0c;你们可以试着写一下 解法二&#xff1a;排序双指针 这题和上一篇文章的两数字和方法类似 排序固定一个数a在这个数的后面区间&#xff0…

《詩經别解》——國風·周南·雎鳩​​​​​​​

一、关于古文的一个认识 目前可以阅读的古文经典&#xff0c;大多是经历了几千年的传承。期间的武力战争、文化纷争、宗教侵袭、官僚介入及文人的私人恩怨与流派桎梏&#xff0c;印刷与制作技术&#xff0c;导致这些古文全部都已经面目全非。简单地说&#xff0c;你读到的都是…

2022最新版-李宏毅机器学习深度学习课程-P46 自监督学习Self-supervised Learning(BERT)

一、概述&#xff1a;自监督学习模型与芝麻街 参数量 ELMO&#xff1a;94MBERT&#xff1a;340MGPT-2&#xff1a;1542MMegatron&#xff1a;8BT5&#xff1a;11BTuring NLG&#xff1a;17BGPT-3&#xff1a;175BSwitch Transformer&#xff1a;1.6T 二、Self-supervised Lear…

[HXPCTF 2021]includer‘s revenge

文章目录 方法一前置知识Nginx 在后端 Fastcgi 响应过大产生临时文件竞争包含绕过include_once限制 解题过程 方法二前置知识Base64 Filter 宽松解析iconv filter 解题过程 方法一 NginxFastCGI临时文件 前置知识 Nginx 在后端 Fastcgi 响应过大产生临时文件 www-data用户在n…

SharePoint 页面中插入自定义代码

我们都知道 SharePoint 是对页面进行编辑的。 对于一些有编程基础的人来说&#xff0c;可能需要对页面中插入代码&#xff0c;这样才能更好的对页面进行配置。 但是在新版本的 SharePoint modern 页面来说&#xff0c;虽然我们可以插入 Embed 组件。 但是 Embed 组件中是不允…

【C++基础 】类和对象(上)

C基础 类和对象&#xff08;上&#xff09; 1.面向过程和面向对象初步认识2.类的引入3.类的定义4.类的访问限定符及封装4.1 访问限定符4.2 封装 5.类的作用域6.类的实例化7.类对象模型7.1 如何计算类对象的大小7.2 类对象的存储方式猜测7.3 结构体内存对齐规则 8.this指针8.1 t…

Kubernetes实战(四)-部署docker harbor私有仓库

1 Docker原生私有仓库Registry 1.1 原生私有仓库Registry概述 Docker的仓库主要分两类&#xff1a; 私有仓库公有仓库 共有仓库只要在官方注册用户&#xff0c;登录即可使用。但对于仓库的使用&#xff0c;企业还是会有自己的专属镜像&#xff0c;所以私有库的搭建也是很有…

分享vmware和Oracle VM VirtualBox虚拟机的区别,简述哪一个更适合我?

VMware和Oracle VM VirtualBox虚拟机的区别主要体现在以下几个方面&#xff1a; 首先两种软件的安装使用教程如下&#xff1a; 1&#xff1a;VMware ESXI 安装使用教程 2&#xff1a;Oracle VM VirtualBox安装使用教程 商业模式&#xff1a;VMware是一家商业公司&#xff0c;而…

HTTP和HTTPS详解

一)什么是HTTP协议 1)HTTP协议是倾向于相遇业务层次上面的一种协议&#xff0c;传输层协议主要考虑的是端对端之间的一个传输过程&#xff0c;TCP重点进行关注的是可靠传输&#xff1b;咱们的HTTP/1&#xff0c;HTTP/2是基于TCP的&#xff0c;但是咱们的HTTP/3是基于UDP的&…

uniapp H5预览PDF支持手势缩放、分页、添加水印、懒加载、PDF下载

效果预览 项目说明 uniapp vue2 node&#xff1a;v14.18.3 npm&#xff1a; 6.14.15 安装pdfh5.js插件 pdfh5 - npm (npmjs.com)pdfh5.js 基于pdf.js和jQuery pdfh5 - npm (npmjs.com) npm install pdfh5 由于我安装最新的pdfh5.js后运行时报错 所以我选择降低版本,可能是node…

Wireshark学习 与 TCP/IP协议分析

Wireshark简介和工具应用 如何开始抓包&#xff1f; 打开wireshark&#xff0c;显示如下网络连接。选择你正在使用的&#xff0c;&#xff08;比如我正在使用无线网上网&#xff09;&#xff0c;双击 可以先看下自己的ip地址和网关ip地址&#xff08;看抓包数据时候会用到&…

索尼RSV文件怎么恢复为MP4视频

索尼相机RSV是什么文件&#xff1f; 如果您的相机是索尼SONY A7S3&#xff0c;A7M4&#xff0c;FX3&#xff0c;FX3&#xff0c;FX6&#xff0c;或FX9等&#xff0c;有时录像会产生一个RSV文件&#xff0c;而没有MP4视频文件。RSV其实是MP4的前期文件&#xff0c;经我对RSV文件…

[Android]_[初级]_[配置gradle的环境变量设置安装位置]

场景 在开发Android项目的时候, gradle是官方指定的构建工具。不同项目通过wrapper指定不同版本的gradle。随着项目越来越多&#xff0c;使用的gradle版本也增多&#xff0c;导致它以来的各种库也增加&#xff0c;系统盘空间不足&#xff0c;怎么解决&#xff1f; 说明 grad…

C/C++调试工具 - gdb详解

C/C调试工具 -gdb详解 1 简介 2 常用的命令 3 使用的条件 4 程序调试 4.1 直接运行程序 4.2 断点调试(在某一行) 4.3 断点调试(在函数入口处打断点) 5 调试core文件 5.1 生成core文件的方法 5.2 调试core文件 1 简介 GDB是Linux下非常好用且强大的调试工具。GD…

一种ADC采样算法,中位值平均滤波+递推平均滤波

前言 在实际AD采集场景中&#xff0c;会出现周期性变化和偶然脉冲波动干扰对AD采集的影响 这里使用中位值平均滤波递推平均滤波的结合 参考前人写好的代码框架&#xff0c;也参考博主GuYH_下面这篇博客&#xff0c;在此基础上稍作修改&#xff0c;写出这篇博客&#xff0c;能…

NZ系列工具NZ06:VBA创建PDF文件说明

我的教程一共九套及VBA汉英手册一部&#xff0c;分为初级、中级、高级三大部分。是对VBA的系统讲解&#xff0c;从简单的入门&#xff0c;到数据库&#xff0c;到字典&#xff0c;到高级的网抓及类的应用。大家在学习的过程中可能会存在困惑&#xff0c;这么多知识点该如何组织…

【腾讯云 HAI域探秘】探索AI绘画之路:利用腾讯云HAI服务打造智能画家

目录 前言1 使用HAI服务作画的步骤1.1 注册腾讯云账户1.2 创建算力服务器1.3 进入模型管理界面1.4 汉化界面1.5 探索AI绘画 2 模型参数的含义和调整建议2.1 模型参数的含义和示例2.2 模型参数的调整建议 3 调整参数作画的实践和效果3.1 实践说明3.2 实践效果13.3 实践效果23.4 …

Leetcode-94 二叉树的中序遍历

递归实现 /*** Definition for a binary tree node.* public class TreeNode {* int val;* TreeNode left;* TreeNode right;* TreeNode() {}* TreeNode(int val) { this.val val; }* TreeNode(int val, TreeNode left, TreeNode right) {* …

creo6.0教程之拉伸

目录 一、实体拉伸&#xff1a;1.拉伸基本操作&#xff1a;2.其他常用的拉伸选项&#xff1a;3.移除材料的拉伸&#xff1a; 一、实体拉伸&#xff1a; 1.拉伸基本操作&#xff1a; 1、点击-拉伸&#xff0c;进入拉伸操作界面 2、选择绘制草图放置的平面&#xff0c;选择放置…