In Need of Some Serious Help


I was asked by my boss to make a “simple” Uno project. He is a big tinker maker.
He loves to decorate his house with Christmas lights. I thought I could do what he
asked because I had some programming in high school. I was so wrong. I reached
deep and fell short. I tried to download libraries and tried to get them to work
together since my programming is so weak. I am looking for someone to give me a lot
of help or someone who would like to make a little money. I’m just over this project
and want to be done and find a C++ class for future requests.

The Project:

Arduino Uno WiFi Rev2
Seeed Base Shield V2
Grove 6-Axis Accelerometer & Gyroscope

Setup an Uno to collect data on fork truck movement. Use the accelerometer to know
when the truck in moving and for how long. Upload the data to the Cloud so the boss
can play with it.

I can attach the Arduino to my home network and show the IP and MAC address. If I
try to then collect the accelerometer data every second it stops after the first
I can attach the Arduino to my home network and comment out the IP and MAC requests
and get the accelerometer data to scroll on the Serial Monitor.
I have not even tried to connect to a Cloud server.

I have attached my attempt at coding and a screen shot of one of my sketches that
I commented out the request for IP and MAC.

I’m using WPA for my home network but once at work it will be on WEP.

Any help appreciated.
If you have additional questions please let me know.


The Attempted Code.txt (3.28 KB)

Can you post the two sketches that work? Your attached code needs some work to get it to compile. Some of it was fixed by guesswork but now the library code is erroring out.

Also, what’s in the secrets file- not the values, just an account of what gets defined there.

Hi Wildbill

Here are the two sketches that I can get to work. Thanks for taking a look.

The secrets file contains the following:

#define SECRET_SSID “MyNetworkID”
#define SECRET_PASS “MyPassword”

Track_a_Fork_Truck_v1.ino (1.29 KB)

Track_a_Truck_NO_Continuous_report.ino (2.72 KB)

I expect there’s some pin conflict between your IMU board & your wifi, but just for fun, what does this do?

//  Track a Fork Truck
//  Hardware:      Grove - 6-Axis Accelerometer&Gyroscope
//  Arduino IDE:   Arduino-1.8.8
//  Author:        Me
//  Date:          Dec,2018
//  Version:       v3.0

#include <SPI.h>
#include <WiFiNINA.h>
//#include "arduino_secrets.h"
#include "SparkFunLSM6DS3.h"
#include "Wire.h"
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
#define SECRET_SSID "MyNetworkID"
#define SECRET_PASS "MyPassword"

char ssid[] = SECRET_SSID;        // your network SSID (name)
char pass[] = SECRET_PASS;    // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS;     // the Wifi radio's status

//Create an instance of class LSM6DS3
LSM6DS3 myIMU( I2C_MODE, 0x6A );  //I2C device address 0x6A

void setup()
  //Initialize serial and wait for port to open:
  while (!Serial)
    ; // wait for serial port to connect. Needed for native USB port only

void setupwifi()
  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE)
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  String fv = WiFi.firmwareVersion();
  if (fv < "1.0.0")
    Serial.println("Please upgrade the firmware");
  // attempt to connect to Wifi network:
  while (status != WL_CONNECTED)
    Serial.print("Attempting to connect to WPA SSID: ");
    // Connect to WPA/WPA2 network:
    status = WiFi.begin(ssid, pass);
    // wait 10 seconds for connection:
  // you're connected now, so print out the data:
  Serial.print("You're connected to the network");

void setupIMU()
  //Call .begin() to configure the IMUs
  if ( myIMU.begin() != 0 )
    Serial.println("Device error");
    Serial.println("Device OK!");

void loop()

void printData()
  // print your board's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.print(" X(truck7) = ");
  Serial.println(myIMU.readFloatAccelX(), 4);
  Serial.print(" Y(truck7) = ");
  Serial.println(myIMU.readFloatAccelY(), 4);
  Serial.print(" Z(truck7) = ");
  Serial.println(myIMU.readFloatAccelZ(), 4);

I can’t do more than compile it - don’t have the hardware

It works great Wildbill. Thank you! Now I just need to configure it for WEP and upload to a Cloud server. Small steps forward.

Wildbill output.jpg

I'm looking for some code to add the date to the output of the accelerometer. I've found tons of sites talking about the time but the date seems to alluding me. Does anyone have a link? In my head what I am thinking is something like this for output. I'm am a newbie so if there is a better way please let me know.

1-3-19, 22:33:41.123 --> X (Truck7) = 0.0034

An accelerometer doesn't tell when a thing is moving, only when it accelerates or tips. To track motion, you need another sensor.