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.rhkb.cn/news/187990.html

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

相关文章

【uniapp】文件授权验真系统(含代码)

文章目录 前言一、框架选用二、数据库设计三、设计上传列表四、上传操作1.前端2.后端 五、修改操作六、访问操作七、二维码生成八、二维码访问九、删除操作总结 前言 吐槽&#xff1a;终于开通了【资源绑定】的功能了&#xff0c;之前还要一个一个的去贴链接 之前的同学联系…

家居美学:将水离子壁炉融入你的现代装饰

当谈及家居装饰和壁炉选择时&#xff0c;水离子雾化壁炉是一个备受瞩目的话题。水离子雾化壁炉的美学价值&#xff0c;还为室内装饰带来全新的维度。它甚至能够激发室内装饰的灵感。 水离子雾化壁炉是现代美学的标志&#xff0c;融合了简洁、线条清晰的设计。这种壁炉常常采用不…

地区 IP 库

地区 & IP 库 yudao-spring-boot-starter-biz-ip (opens new window)业务组件&#xff0c;提供地区 & IP 库的封装。 #1. 地区 AreaUtils (opens new window)是地区工具类&#xff0c;可以查询中国的省、市、区县&#xff0c;也可以查询国外的国家。 它的数据来自 …

React动态生成二维码和毫米(mm)单位转像素(px)单位

一、使用qrcode.react生成二维码&#xff0c;qrcode.react - npm 很简单&#xff0c;安装依赖包&#xff0c;然后引用就行了 npm install qrcode.react或者 yarn add qrcode.react直接上写好的代码 import React, {useEffect, useState} from react; import QRCode from qr…

6.存储器概述,主存储器

目录 一. 存储系统基本概念 &#xff08;1&#xff09;存储系统的层次结构 &#xff08;2&#xff09;分类 &#xff08;3&#xff09;存储器的性能指标 二. 主存储器的基本组成 三. SRAM和DRAM 四. 只读存储器ROM 五. 提升主存速度的方法 &#xff08;1&#xff09;双…

复杂度计算实例

1.常见时间复杂度计算举例 实例1 实例1基本操作执行了2N10次&#xff0c;通过推导大O阶方法知道&#xff0c;时间复杂度为 O(N) 实例2 实例2基本操作执行了MN次&#xff0c;有两个未知数M和N&#xff0c;时间复杂度为 O(NM) 实例3 实例3基本操作执行了100次&#xff0c;通过…

FTP、NFS以及SAMBA服务

一、FTP服务 1、Linux下ftp客户端管理工具 ftp、lftp都是Linux下ftp的客户端管理工具&#xff0c;但是需要独立安装 # yum install ftp lftp -y ☆ ftp工具 # ftp 10.1.1.10 Connected to 10.1.1.10 (10.1.1.10). 220 (vsFTPd 3.0.2) Name (10.1.1.10:root): 输入FTP的账号…

游戏公司数据分析师必备知识(持续补充中...)

1.如何撰写专题报告&#xff1f; ①原则 只有一个主题&#xff1a;即使不讲ppt&#xff0c;业务方也能看得懂行文通俗简单易懂&#xff1a;学习产品经理平常是如何写报告的明确的数据结论和落地项先行&#xff1a;跟业务方多沟通数据结论&#xff0c;让他们给出落地项 ②结构…

【星海随笔】git的使用

1.在终端&#xff0c;检查git是否安装 git --version 2.没有安装的话去&#xff0c;官网&#xff0c;下载git 3.一直点下一步即可 4.安装后在终端检查git是否安装好 5.设置用户名和邮件地址(最好和GitHub的用户名/邮箱保持一致) git config --global user.name “自己的用户名”…

Linux编写一个极简版本的Shell

Linux编写一个极简版本的Shell &#x1f4df;作者主页&#xff1a;慢热的陕西人 &#x1f334;专栏链接&#xff1a;Linux &#x1f4e3;欢迎各位大佬&#x1f44d;点赞&#x1f525;关注&#x1f693;收藏&#xff0c;&#x1f349;留言 本博客主要内容在Linux环境下&#xff…

Markdown使用教程

这里写自定义目录标题 欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题&#xff0c;有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants 创建一个自定义列表如何创建一个…

笔记本电脑的麦克风没有声音

笔记本电脑的麦克风没有声音是一个常见的问题&#xff0c;可能是由于以下几个原因导致的&#xff1a; 第一&#xff0c;麦克风没有启用或者被禁用了。在Windows系统中&#xff0c;右键单击任务栏上的音量图标&#xff0c;选择“录音设备”&#xff0c;在弹出窗口中找到麦克风&a…

Python+Appium自动化测试-编写自动化脚本

一&#xff0c;连接测试手机&#xff0c;获取测试机及被测APP配置 配置信息如下&#xff1a; {"platformName": "Android","platformVersion": "10","deviceName": "PCT_AL10","appPackage": "c…

【技术支持】DevTools中重写覆盖源js文件

sources面板下&#xff0c;左侧overrides标签下添加一个文件夹&#xff0c;并同意。 勾选Enable Local overrides 然后在page标签下&#xff0c;修改文件后ctrls保存 直接就保存在overrides的文件夹下了 或者文件上右键Override content

【leaflet】1. 初见

▒ 目录 ▒ &#x1f6eb; 导读需求开发环境 1️⃣ 概念概念解释特点 2️⃣ 学习路线图3️⃣ html示例&#x1f6ec; 文章小结&#x1f4d6; 参考资料 &#x1f6eb; 导读 需求 要做游戏地图了&#xff0c;看到大量产品都使用的leaflet&#xff0c;所以开始学习这个。 开发环境…

【操作系统内核】线程

【操作系统内核】线程 为什么需要线程 比如我要做一个视频播放器&#xff0c;就需要实现三个功能&#xff1a; ① 从磁盘读取视频数据 ② 对读取到的视频数据进行解码 ③ 对解码的数据进行播放 如果串行执行&#xff08;通过一个进程来执行&#xff09;&#xff1a; 那么…

redis配置文件详解

一、配置文件位置 以配置文件启动 Redis 的配置文件位于 Redis 安装目录下,文件名为 redis.conf ( Windows名为redis.windows. conf) 例: # 这里要改成你自己的安装目录 cd ./redis-6.0.8 vim redis.conf redis对配置文件对大小写不敏感 二、配置文件 1、获取当前服务的…

CSS特效第一弹:右上角tag标志纯代码前端实现(非图片)

&#x1f60e;效果&#xff1a; &#x1f937;‍♂️思路&#xff1a; 分为2个部分&#xff1a; 1.文字方块右下角折角 文字方块用绝对定位z-index让文字方块悬浮在右上角的位置 2.右下角折角通过before伪元素border属性实现(三角形实现方法&#xff09; &#x1f44d;核心代…

15 # 手写 throttle 节流方法

什么是节流 节流是限制事件触发的频率&#xff0c;当持续触发事件时&#xff0c;在一定时间内只执行一次事件&#xff0c;这个效果跟英雄联盟里的闪现技能释放差不多。 函数防抖关注一定时间连续触发的事件只在最后执行一次&#xff0c;而函数节流侧重于一段时间内只执行一次…

现在个人想上架微信小游戏已经这么难了吗...

点击上方亿元程序员关注和★星标 引言 大家好&#xff0c;最近我突然想起来我还有一款微信小游戏还没有上架&#xff0c;于是捣鼓了一天把游戏完善了一下&#xff0c;然后准备提交审核&#xff0c;却发现异常的艰难… 1.为什么难&#xff1f; 相信大家都大概知道&#xff0c…