驴友花雕 发表于 2021-8-9 09:16:58

实验场景动态图








郑同学 发表于 2021-8-10 08:33:53

你好,我最近刚从淘宝入手这么一块板子,可是淘宝只提供安装环境,不提供教程,想请问题主是怎么学习的?可以的话希望可以交流学习

驴友花雕 发表于 2021-8-10 10:21:48

郑同学 发表于 2021-8-10 08:33
你好,我最近刚从淘宝入手这么一块板子,可是淘宝只提供安装环境,不提供教程,想请问题主是怎么学习的?可 ...

这板子挺强大的,我也是头回接触,我的笨办法就是发帖子,多做实验,多尝试

郑同学 发表于 2021-8-11 22:54:11

驴友花雕 发表于 2021-8-10 10:21
这板子挺强大的,我也是头回接触,我的笨办法就是发帖子,多做实验,多尝试 ...

看到题主你做了挺多试验,想请问几个点,我想此板子和PC通讯,一个是WIFI一个是蓝牙,但我发现二者都行不通,WIFI连接wifi之后板子无法访问网页总是超时,而采用蓝牙时,无法用Python实现,不知道题主有何建议吗?

驴友花雕 发表于 2021-8-12 06:44:23

本帖最后由 驴友花雕 于 2021-8-12 06:45 编辑

郑同学 发表于 2021-8-11 22:54
看到题主你做了挺多试验,想请问几个点,我想此板子和PC通讯,一个是WIFI一个是蓝牙,但我发现二者都行不 ...
不太了解你的相关基础与专业经历

以我的经验来说,肯定是先从简单的开始,比如没有见过的传感器模块,上手后会用放大镜查看芯片型号,再去网上查询相关的资料,争取有个大致的了解,然后是关心适合的平台,编程控制等;另如上手一块开发板,会根据型号,先去搜集其资料包,然后尝试建立简单的开发环境,Hello World,再实验一些基础性的例程,慢慢了解与熟悉。凡事有过程,这里以为一步一步来,循序渐进会为稳妥一些,仅供参考。

皮莱仕 发表于 2021-11-11 15:54:18

博主你好,为什么我用这块板子配置好ESP32环境后,不能使用ESP32舵机库,说库和这块板子不兼容,这块板子不是基于ESP32的吗?为什么不能使用ESP32舵机库

皮莱仕 发表于 2021-11-11 15:56:13

具体情况如下

驴友花雕 发表于 2021-11-14 14:36:43

皮莱仕 发表于 2021-11-11 15:54
博主你好,为什么我用这块板子配置好ESP32环境后,不能使用ESP32舵机库,说库和这块板子不兼容,这块板子不 ...

ESP32也有不同板型,有一定的区别,您用的什么板子?

驴友花雕 发表于 2022-11-16 09:22:57

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验一百七十七:Wemos D1 R32 ESP32开发板
项目之四十一:绿色快闪点亮8X32位WS2812B屏

/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验一百七十七:Wemos D1 R32 ESP32开发板
项目之四十一:绿色快闪点亮8X32位WS2812B屏
*/

#include <Adafruit_NeoPixel.h>

#define PIN 23
#define MAX_LED 256

int val = 0;

Adafruit_NeoPixel strip = Adafruit_NeoPixel( MAX_LED, PIN, NEO_RGB + NEO_KHZ800 );

void setup() {
strip.setBrightness(50);
strip.begin();
strip.show();
}

void loop() {
uint8_t i, a = 0;
uint32_t color = strip.Color(160, 10, 10);
while (a < 257)
{
    for (i = 0; i < 255; i++)
    {
      if (i == a) strip.setPixelColor(i, color);
      else strip.setPixelColor(i, 0);
    }
    strip.show();
    delay(2);
    a++;
}
}

驴友花雕 发表于 2022-11-16 09:29:02

实验场景图动态图



驴友花雕 发表于 2022-11-16 09:32:09

实验场景图


驴友花雕 发表于 2022-11-16 10:02:41

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验一百七十七:Wemos D1 R32 ESP32开发板
项目之四十二:WS2812FX库最简单的点亮形式

/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验一百七十七:Wemos D1 R32 ESP32开发板
项目之四十二:WS2812FX库最简单的点亮形式
*/

#include <WS2812FX.h> //导入库
#define LED_COUNT 256 //WS2812B LED数量
#define LED_PIN    23 //WS2812B LED接脚

WS2812FX ws2812fx = WS2812FX(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
ws2812fx.init(); //初始化
ws2812fx.setBrightness(35); //设置亮度(0-255),可以控制总电流(重要!)
ws2812fx.setSpeed(100); // 设置速度
ws2812fx.setMode(FX_MODE_FIREWORKS_RANDOM);// 设置模式(内置63种模式)
ws2812fx.start(); //启动
}

void loop() {
ws2812fx.service(); //循环运行
}

驴友花雕 发表于 2022-11-16 10:29:27

实验场景图



驴友花雕 发表于 2022-11-16 10:31:42

实验场景图动态图



驴友花雕 发表于 2022-11-16 11:06:39

声音模块,使用性价比更高的MAX4466声音传感器

MAX4466模块特点
电源电压:+2.4V至+5.5V(可直接接STM/ARDUNIO/树莓派等开发板)
电源抑制比:112dB
共模抑制比:126dB
AVOL:125dB(RL = 100kΩ) 轨到轨输出
静态电源电流:24μA
增益带宽:600kHz
尺寸:20.8mm x 13.8mm x 7.5mm/0.8 x 0.5 x 0.3inch



驴友花雕 发表于 2022-11-16 13:42:50

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验一百七十七:Wemos D1 R32 ESP32开发板
项目之四十三:esp32 max4466 简易串口读取声级

/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验一百七十七:Wemos D1 R32 ESP32开发板
项目之四十三:esp32 max4466 简易串口读取声级
*/

void setup() {
Serial.begin(9600);
}

void loop() {
int micin;
micin = analogRead(39);
Serial.println(micin);
delay(300);
}

驴友花雕 发表于 2022-11-16 13:44:26

实验串口返回情况


驴友花雕 发表于 2022-11-16 13:46:36

打开Arduino IDE——工具——串口绘图器,查看实验波形


驴友花雕 发表于 2022-11-16 13:48:46

实验串口绘图器返回情况


驴友花雕 发表于 2022-11-16 15:07:22

ESP32 与 Arduino 模拟输入的区别注意事项。

使用支持 ADC 的 GPIO 引脚
读数范围从 0 到 4095(Arduino 为 0 到 1023)
读取电压范围0~3.3V(Arduino为0~5V)
但是,读取范围和分辨率可以通过默认设置来更改。此外,它似乎从 3.2V 左右返回 4095 的值(参考:ESP32 ADC)

由于读数电压高达3.3V,麦克风供电采用3.3V。接线示例如下。请注意,ESP32 有很多变体,其中许多具有不同的管脚布局,因此管脚布局不一定是下面的。



驴友花雕 发表于 2022-11-16 15:23:54

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验一百七十七:Wemos D1 R32 ESP32开发板
项目之四十四:esp32 NeoPixel 灯板测试程序

/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验一百七十七:Wemos D1 R32 ESP32开发板
项目之四十四:esp32 NeoPixel 灯板测试程序
*/

#include <Adafruit_NeoPixel.h>

// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1:
#define LED_PIN    23

// How many NeoPixels are attached to the Arduino?
#define LED_COUNT 256

// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
// Argument 1 = Number of pixels in NeoPixel strip
// Argument 2 = Arduino pin number (most are valid)
// Argument 3 = Pixel type flags, add together as needed:
//   NEO_KHZ800800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB   Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB   Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)


// setup() function -- runs once at startup --------------------------------

void setup() {
// These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
// Any other board, you can remove this part (but no harm leaving it):
//#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
//clock_prescale_set(clock_div_1);
//#endif
// END of Trinket-specific code.

strip.begin();         // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show();            // Turn OFF all pixels ASAP
strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
}


// loop() function -- runs repeatedly as long as board is on ---------------

void loop() {
// Fill along the length of the strip in various colors...
colorWipe(strip.Color(255,   0,   0), 50); // Red
colorWipe(strip.Color(0, 255,   0), 50); // Green
colorWipe(strip.Color(0,   0, 255), 50); // Blue

// Do a theater marquee effect in various colors...
theaterChase(strip.Color(127, 127, 127), 50); // White, half brightness
theaterChase(strip.Color(127,   0,   0), 50); // Red, half brightness
theaterChase(strip.Color(0,   0, 127), 50); // Blue, half brightness

rainbow(10);             // Flowing rainbow cycle along the whole strip
theaterChaseRainbow(50); // Rainbow-enhanced theaterChase variant
}


// Some functions of our own for creating animated effects -----------------

// Fill strip pixels one after another with a color. Strip is NOT cleared
// first; anything there will be covered pixel by pixel. Pass in color
// (as a single 'packed' 32-bit value, which you can get by calling
// strip.Color(red, green, blue) as shown in the loop() function above),
// and a delay time (in milliseconds) between pixels.
void colorWipe(uint32_t color, int wait) {
for (int i = 0; i < strip.numPixels(); i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //Set pixel's color (in RAM)
    strip.show();                        //Update strip to match
    delay(10);                           //Pause for a moment
}
}

// Theater-marquee-style chasing lights. Pass in a color (32-bit value,
// a la strip.Color(r,g,b) as mentioned above), and a delay time (in ms)
// between frames.
void theaterChase(uint32_t color, int wait) {
for (int a = 0; a < 10; a++) { // Repeat 10 times...
    for (int b = 0; b < 3; b++) { //'b' counts from 0 to 2...
      strip.clear();         //   Set all pixels in RAM to 0 (off)
      // 'c' counts up from 'b' to end of strip in steps of 3...
      for (int c = b; c < strip.numPixels(); c += 3) {
      strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
      }
      strip.show(); // Update strip with new contents
      delay(10);// Pause for a moment
    }
}
}

// Rainbow cycle along whole strip. Pass delay time (in ms) between frames.
void rainbow(int wait) {
// Hue of first pixel runs 5 complete loops through the color wheel.
// Color wheel has a range of 65536 but it's OK if we roll over, so
// just count from 0 to 5*65536. Adding 256 to firstPixelHue each time
// means we'll make 5*65536/256 = 1280 passes through this outer loop:
for (long firstPixelHue = 0; firstPixelHue < 5 * 65536; firstPixelHue += 256) {
    for (int i = 0; i < strip.numPixels(); i++) { // For each pixel in strip...
      // Offset pixel hue by an amount to make one full revolution of the
      // color wheel (range of 65536) along the length of the strip
      // (strip.numPixels() steps):
      int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
      // strip.ColorHSV() can take 1 or 3 arguments: a hue (0 to 65535) or
      // optionally add saturation and value (brightness) (each 0 to 255).
      // Here we're using just the single-argument hue variant. The result
      // is passed through strip.gamma32() to provide 'truer' colors
      // before assigning to each pixel:
      strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
    }
    strip.show(); // Update strip with new contents
    delay(10);// Pause for a moment
}
}

// Rainbow-enhanced theater marquee. Pass delay time (in ms) between frames.
void theaterChaseRainbow(int wait) {
int firstPixelHue = 0;   // First pixel starts at red (hue 0)
for (int a = 0; a < 30; a++) { // Repeat 30 times...
    for (int b = 0; b < 3; b++) { //'b' counts from 0 to 2...
      strip.clear();         //   Set all pixels in RAM to 0 (off)
      // 'c' counts up from 'b' to end of strip in increments of 3...
      for (int c = b; c < strip.numPixels(); c += 3) {
      // hue of pixel 'c' is offset by an amount to make one full
      // revolution of the color wheel (range 65536) along the length
      // of the strip (strip.numPixels() steps):
      int      hue   = firstPixelHue + c * 65536L / strip.numPixels();
      uint32_t color = strip.gamma32(strip.ColorHSV(hue)); // hue -> RGB
      strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
      }
      strip.show();                // Update strip with new contents
      delay(10);               // Pause for a moment
      firstPixelHue += 65536 / 90; // One cycle of color wheel over 90 frames
    }
}
}

页: 1 2 3 4 5 6 7 [8] 9 10
查看完整版本: 最像Arduino Uno的ESP32开发板之WeMos D1 R32