Arduino integration with VESC issue

I am trying to integrate the vesc with arduino and I am running a simple code to print the voltage and other data into the serial monitor. Below is the code for reference. When I check the output, it doesnt seem to be failing all the time. I am using the the library by solidgeek: SolidGeek/VescUart: An Arduino library for interfacing with the VESC over UART (
and here is the code I have on it:

  Name:    getVescValues.ino
  Created: 19-08-2018
  Author:  SolidGeek
  Description:  This example is made using a Arduino Micro (Atmega32u4) that has a HardwareSerial port (Serial1) separated from the Serial port. 
                A Arduino Nano or Uno that only has one Serial port will not be able to display the data returned.

#include "VescUart.h"
#include <Adafruit_Fingerprint.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);

#if defined(ARDUINO_FEATHER_ESP32) // Feather Huzzah32
#define TFT_CS         14
#define TFT_RST        15
#define TFT_DC         32

#elif defined(ESP8266)
#define TFT_CS         4
#define TFT_RST        16
#define TFT_DC         5

// For the breakout board, you can use any 2 or 3 pins.
// These pins will also work for the 1.8" TFT shield.
#define TFT_CS        1 // D v25 changes to use pin 1 for CS in MKR1500
#define TFT_RST        -1 // Or set to -1 and connect to Arduino RESET pin // D v25 changes to use built in reset pinout in MKR1500
#define TFT_DC         2 // D v25 changes to use pin 2 for CS in MKR1500

//D v15 for audrino to connect to fingerprint sensor
//D v2
#if (defined(__AVR__) || defined(ESP8266)) && !defined(__AVR_ATmega2560__)
// For UNO and others without hardware serial, we must use software serial...
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino  (WHITE wire)
// Set up the serial port to use softwareserial..
SoftwareSerial mySerial(2, 4);

// On Leonardo/M0/etc, others with hardware serial, use hardware serial!
// #0 is green wire, #1 is white
#define mySerial Serial1


const int DIN_PIN = 7;
int LedPin=6;

// OPTION 1 (recommended) is to use the HARDWARE SPI pins, which are unique
// to each board and not reassignable. For Arduino Uno: MOSI = pin 11 and
// SCLK = pin 13. This is the fastest mode of operation and is required if
// using the breakout board's microSD card.

// For 1.44" and 1.8" TFT with ST7735 use:
//Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST); // D v21 uncomment this and comment the line below to use 1.44inch display.Need to change the display font in case I use 1.44"

// For 1.14", 1.3", 1.54", and 2.0" TFT with ST7789:
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST); // D v22 uncommment to use this display

/** Initiate VescUart class */
VescUart UART;

void setup() {

  /** Setup Serial port to display data */

  /** Setup UART port (Serial1 on Atmega32u4) */
  Serial1.begin(115200); // Serial1.begin(19200);
  while (!Serial1) {;}

  /** Define which ports to use as UART */
  // tft.initR(INITR_144GREENTAB); // Init ST7735R chip, green tab

  // OR use this initializer (uncomment) if using a 1.3" or 1.54" 240x240 TFT:
  tft.init(240, 240);           // Init ST7789 240x240  // D v22 uncommment to use this display

  // tft print function!
tft.println("Test display ");

void loop() {
  /** Call the function getVescValues() to acquire data from VESC */
  if ( UART.getVescValues() ) {


    tft.println("Failed to get data!");


void tftPrintTest() {
  tft.setCursor(0, 0);

I have set the baud rate on the vesc as 115200 and same in the code, but it still gives me an issue.
5V Vesc-> 5V arduino
GND VESC-> GND arduino
RX VESC-> TX arduino
TX VESC -> RX arduino.

I am using Vesc6MKv5 and arduino MKR1400.

regarding the abbreviation "VESC" I have no idea what this means.
I looked up the link that you have posted. But there is the same expert-blindness-about-beginners-dificulties. Just the abbreviation. No explanation.
best regards Stefan

VESC is an electronics speed controller by Benjamin vedder. That is used in electric skateboards.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.