首页 > 解决方案 > 节点 mcu 不显示 RGB 值

问题描述

平台

硬件:ESP-01

开发环境:[Arduino IDE|

操作系统:[Windows|

IDE 中的设置

模块:[通用 ESP8266 模块|

闪光模式:[DOUT]

闪存大小:[512KB]

lwip 变体:|v2 低内存|

重置方法:[ck]

闪光频率:[40Mhz]

CPU频率:[80Mhz]

上传使用:[SERIAL]

上传速度:[115200]

我正在使用连接到 TCS3200 颜色传感器的 Node MCU。但是串口监视器不显示RGB值

我的代码:

// TCS230 or TCS3200 pins wiring to Arduino
#define S0 D4
#define S1 D5
#define S2 D6
#define S3 D7
#define sensorOut D8

// Stores frequency read by the photodiodes
int redFrequency = 0;
int greenFrequency = 0;
int blueFrequency = 0;

void setup() {
  // Setting the outputs
  pinMode(S0, OUTPUT);
  pinMode(S1, OUTPUT);
  pinMode(S2, OUTPUT);
  pinMode(S3, OUTPUT);
  
  // Setting the sensorOut as an input
  pinMode(sensorOut, INPUT);
  
  // Setting frequency scaling to 20%
  digitalWrite(S0,HIGH);
  digitalWrite(S1,LOW);
  
   // Begins serial communication 
  Serial.begin(115200);
}
void loop() {
  // Setting RED (R) filtered photodiodes to be read
  digitalWrite(S2,LOW);
  digitalWrite(S3,LOW);
  
  // Reading the output frequency
  redFrequency = pulseIn(sensorOut, LOW);
  
   // Printing the RED (R) value
  Serial.print("R = ");
  Serial.print(redFrequency);
  delay(100);
  
  // Setting GREEN (G) filtered photodiodes to be read
  digitalWrite(S2,HIGH);
  digitalWrite(S3,HIGH);
  
  // Reading the output frequency
  greenFrequency = pulseIn(sensorOut, LOW);
  
  // Printing the GREEN (G) value  
  Serial.print(" G = ");
  Serial.print(greenFrequency);
  delay(100);
 
  // Setting BLUE (B) filtered photodiodes to be read
  digitalWrite(S2,LOW);
  digitalWrite(S3,HIGH);
  
  // Reading the output frequency
  blueFrequency = pulseIn(sensorOut, LOW);
  
  // Printing the BLUE (B) value 
  Serial.print(" B = ");
  Serial.println(blueFrequency);
  delay(100);
}

问题 :

ets Jan  8 2013,rst cause:4, boot mode:(3,6)
wdt reset
load 0x4010f000, len 3460, room 16 
tail 4
chksum 0xcc
load 0x3fff20b8, len 40, room 4 
tail 4
chksum 0xc9
csum 0xc9
v00042140
~ld

标签: cesp8266nodemcuarduino-esp8266esp8266wifi

解决方案


推荐阅读