Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.

How to get Serial data from jevois to NodeMCU ?

+2 votes

Hello everyone,

I am trying to use this simple c code to get infos from the jevois camera to be printed on my computer ArduinoIDE Serial monitor thru a NodeMCU Lolin V3 :

#include<SoftwareSerial.h>
SoftwareSerial txrx(D5,D6);

void setup() {
  Serial.begin(115200);
  txrx.begin(115200);
}

void loop() {
  txrx.write("info");
  while (txrx.available() > 0) {
    Serial.print((char)txrx.read());
  }
}

My serial monitor (on computer) is set to 115200 Bauds and the 4Pins serial from jevois is wired to the NodeMCU this way :

Jevois RED --------> nodemcu Vin

Jevois BLACK ----> nodemcu Ground

Jevois YELLOW -> nodemcu D6

jevois WHITE -----> nodemcu D5

I have weird behaviors during my tests. 

The NodeMCU seems not to send commands correctly, and i can't get proper datas from jevois.

Sometimes i receives stuff bus it's mosly garbage chars.

 What am i doing wrong ?

asked Apr 3 in Programmer Questions by opusr (460 points)

1 Answer

0 votes
 
Best answer

It seems that it's not possible to use both RxTx pins and serial monitor. It works using following code:


#include <ESP8266WiFi.h>
#include <ESP8266httpUpdate.h>
#define INLEN 256

char instr[INLEN + 1];

const char* ssid = "SSID";
const char* password = "PWD";
const int led=2;

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    delay(1000);
    ESP.restart();
  }
}

void loop() {
   digitalWrite(led, LOW);
  Serial.println("info");
  
  String val = "test=";

  while (Serial.available()) {
        val.concat((char)Serial.read());
  }

  HTTPClient http;    //Declare object of class HTTPClient
          http.begin("http://192.168.1.33/duino/read_post_request.php");
          http.addHeader("Content-Type", "application/x-www-form-urlencoded"); 
          int httpCode = http.POST(val); 
          http.end();
         digitalWrite(led, HIGH);
  delay(1000);
}

answered Apr 3 by opusr (460 points)
...