Odd ADAFRUIT error for programming

Attached is the code and picture of error. any help would be appreciated.


jamesnov18.zip (1.68 KB)

image0.zip (596 KB)

Here is some help.

You want I to download 2 zip files, unzip them, move them to a folder and...

Why not make it easy for us to help you?

Post your well formatted code in code tags, post your image in img tags.

Very few, if any, members will bother with zip files. Do not post pictures of code or errors. In the IDE there is a "copy error message" button. Use it and paste the error message in a new post in code tags.

Read the forum guidelines to get some good advice on how to get the most from the forum and how to properly post code.

OP’s code:

//The DIY Life
//Michael Klements
//31 July 2020

#include <SPI.h>                                  //Import the libraries required for the display and low power mode
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <LowPower.h>

#define SCREEN_WIDTH  128                         //OLED display width, in pixels
#define SCREEN_HEIGHT 32                          //OLED display height, in pixels

#define OLED_RESET     -1                         //Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); //Create the display object

#define statusLED 4                               //Define the LED & sensor pins
#define lowLED 5
#define highLED 6
#define sensorPin 10

#define dryCal 1000                               //Define the wet and dry calibration limits
#define wetCal 500

#define buttonPin 2                               //Define the button pin number

#define moisturePin A0                            //Define the analog input pin numbers
#define lowSetPin A1
#define highSetPin A2

int moisture = 0;                                 //Create variables for the analog inputs
int lowSet = 0;
int highSet = 0;

int cycleCount = 0;                               //Create a counter to flash the status LED

void setup() 
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);      //Connect to the display
  display.clearDisplay();                         //Clear the display
  display.setTextSize(1);                         //Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE);            //Draw white text
  display.setCursor(10,5);                        //Display splash screen
  display.print(F("The DIY Life"));
  display.print(F("Soil Moisture Meter"));
  display.clearDisplay();                         //Clear display
  pinMode(statusLED, OUTPUT);                     //Set the pin modes
  pinMode(lowLED, OUTPUT);
  pinMode(highLED, OUTPUT);
  pinMode(sensorPin, OUTPUT);
  pinMode(buttonPin, INPUT);

void loop()
  updateValues();                                 //Call the function to update the analog input values
  if (digitalRead(buttonPin) == HIGH)             //If the button is pushed
    while(digitalRead(buttonPin) == HIGH)         //While the button stays pushed
      display.clearDisplay();                     //Display the analog input values
      display.print(F("Moisture: "));
      display.print(F("Low Setpoint: "));
      display.print(F("High Setpoint: "));
      delay(1000);                                //Wait 1000ms between each display update
      updateValues();                             //Get updated analog input values, allows pots adjustments to be seen
    display.clearDisplay();                       //When button is released, clear the display to turn it off
  if(moisture<=lowSet)                            //If the soil moisture level is low, flash the low LED
    digitalWrite(lowLED, HIGH);
    digitalWrite(lowLED, LOW);
  if(moisture>=highSet)                           //If the soil moisture level is high, flash the high LED
    digitalWrite(highLED, HIGH);
    digitalWrite(highLED, LOW);
  if(cycleCount>=5)                               //Every 5 cycles, flash the status LED and reset the counter
    digitalWrite(statusLED, HIGH);
    digitalWrite(statusLED, LOW);
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); //Enter low power mode for 8 seconds
  cycleCount++;                                   //Increment the cycle counter

void updateValues ()                                              //Function to update the analog input values
  //digitalWrite(sensorPin, HIGH);                                //LOW Power Mode - Turn the moisture sensor on
  //delay(200);                                                   //LOW Power Mode - Wait for it to power up and stabilise
  moisture = map(analogRead(moisturePin),wetCal,dryCal,100,0);    //Read the soil moisture measurement
  //digitalWrite(sensorPin, LOW);                                 //LOW Power Mode - Turn the moisture sensor off
  lowSet = map(analogRead(lowSetPin),0,1023,0,100);               //Read in the low setpoint pot value
  if (lowSet>=highSet)                                            //Make sure that the low setpoint cannot be greater than the high
  highSet = map(analogRead(highSetPin),0,1023,0,100);             //Read in the high setpoint pot value
  if (highSet<=lowSet)                                            //Make sure that the high setpoint cannot be less than the low

I successfully compiled it for an Uno with Adafruit_SSD1306 ver 2.4.1 installed.

What Arduino are you using and what version of the library do you have?

I am using Arduino Pro Mini and version 2.4.1, I have gotten past the issue, now I cannot get past “3020 timeout after 400ms” RecieveData time out.

thanks for responding and if you have any suggestions for this error? I am using a chromebook, and a /dev/ttyUSBO

thanks again

I don't, sorry. I'm just using Win10 machines and the 1.8.13 IDE.

Maybe someone else can chime in.

If you search google or the forum you can find more info on the error. For example: