House Generator Auto Start

GM All,

I found this .ino file on the following link:

I attempted to verify the .ino in Arduino IDE but encountered a number of errors. Am I doing something wrong here?, or is there a problem with the code?

I have attached the file. Any help is greatly appreciated!!

generator.ino (17.7 KB)

Don't you think it could be useful to tell us what the errors you encountered were?

I'm going to take a WAG and say you don't have this library installed:

#include <SSD1306AsciiAvrI2c.h> oled;

meltDown:
I'm going to take a WAG and say you don't have this library installed:

#include <SSD1306AsciiAvrI2c.h> oled;

Load the sketch
Verify and when you get errors,
copy and then paste them here.

Looks to me that you are missing this library. GitHub - greiman/SSD1306Ascii: Text only Arduino Library for SSD1306 OLED displays

Error message:


Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino/Genuino Uno"

Build options changed, rebuilding all
C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void setup()':

generator:122:3: error: 'emon1' was not declared in this scope

emon1.voltage(1, 110, 1.7); //voltage: input pin on Analog2, calibration, phase_shift

^

generator:126:3: error: 'oled' was not declared in this scope

oled.begin(&Adafruit128x64, I2C_ADDRESS);

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void gen_status()':

generator:142:3: error: 'oled' was not declared in this scope

oled.print("RPM ");

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void volt_status()':

generator:156:15: error: 'emon1' was not declared in this scope

float Vrms = (emon1.Vrms - 3); emon1.calcVI(10,1000); //Calculate all. No of half wavelengths (crossings), time-out

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void choke()':

generator:184:3: error: 'oled' was not declared in this scope

oled.print("Full choke ");

^

generator:193:4: error: 'oled' was not declared in this scope

oled.print("half choke ");

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void button()':

generator:203:3: error: 'DateTime' was not declared in this scope

DateTime now = RTC.now();

^

generator:207:7: error: 'oled' was not declared in this scope

oled.println("Verified");

^

generator:212:7: error: 'oled' was not declared in this scope

oled.println("Hold button");

^

generator:217:23: error: 'now' was not declared in this scope

Now_Stop_Time = now.unixtime();

^

generator:220:7: error: 'oled' was not declared in this scope

oled.println("Allow shutdown");

^

generator:225:7: error: 'oled' was not declared in this scope

oled.println("Hold button");

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void genstart()':

generator:237:5: error: 'oled' was not declared in this scope

oled.print(IGN_Attempt);

^

generator:292:7: error: 'oled' was not declared in this scope

oled.println("Generator running");

^

generator:301:7: error: 'oled' was not declared in this scope

oled.println("Failed to start!");

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void genshutdown()':

generator:311:3: error: 'oled' was not declared in this scope

oled.print("Generator");

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void testrun()':

generator:321:3: error: 'DateTime' was not declared in this scope

DateTime now = RTC.now();

^

generator:322:6: error: 'now' was not declared in this scope

if(now.day()==15 && now.hour()==12 && now.minute()==00 && TestState==LOW && GenState==LOW) { //Test the generator by starting at specified time and date

^

generator:324:5: error: 'oled' was not declared in this scope

oled.println("Running test");

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void loop()':

generator:369:3: error: 'DateTime' was not declared in this scope

DateTime now = RTC.now();

^

generator:382:5: error: 'oled' was not declared in this scope

oled.println("Power lost");

^

generator:387:18: error: 'now' was not declared in this scope

Serial.print(now.month(), DEC);

^

generator:396:5: error: 'oled' was not declared in this scope

oled.print("Good ");

^

Multiple libraries were found for "Servo.h"
Used: C:\Users\Owner\Documents\Arduino\libraries\Servo
Not used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Servo
exit status 1
'emon1' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


@ AWOL

Just posted the error message

I added the following library and received the previously posted errors:


#include <SSD1306AsciiAvrI2c.h> oled;

derekruss:
I added the following library and received the previously posted errors:


#include <SSD1306AsciiAvrI2c.h> oled;

Not sure what that code snippet is and I sure hope that is not how you added an include. Now, do you think you could be so kind as to post your latest attempt.


Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void setup()':

generator:129:3: error: 'emon1' was not declared in this scope

emon1.voltage(1, 110, 1.7); //voltage: input pin on Analog2, calibration, phase_shift

^

generator:133:3: error: 'oled' was not declared in this scope

oled.begin(&Adafruit128x64, I2C_ADDRESS);

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void gen_status()':

generator:149:3: error: 'oled' was not declared in this scope

oled.print("RPM ");

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void volt_status()':

generator:163:15: error: 'emon1' was not declared in this scope

float Vrms = (emon1.Vrms - 3); emon1.calcVI(10,1000); //Calculate all. No of half wavelengths (crossings), time-out

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void choke()':

generator:191:3: error: 'oled' was not declared in this scope

oled.print("Full choke ");

^

generator:200:4: error: 'oled' was not declared in this scope

oled.print("half choke ");

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void button()':

generator:210:3: error: 'DateTime' was not declared in this scope

DateTime now = RTC.now();

^

generator:214:7: error: 'oled' was not declared in this scope

oled.println("Verified");

^

generator:219:7: error: 'oled' was not declared in this scope

oled.println("Hold button");

^

generator:224:23: error: 'now' was not declared in this scope

Now_Stop_Time = now.unixtime();

^

generator:227:7: error: 'oled' was not declared in this scope

oled.println("Allow shutdown");

^

generator:232:7: error: 'oled' was not declared in this scope

oled.println("Hold button");

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void genstart()':

generator:244:5: error: 'oled' was not declared in this scope

oled.print(IGN_Attempt);

^

generator:299:7: error: 'oled' was not declared in this scope

oled.println("Generator running");

^

generator:308:7: error: 'oled' was not declared in this scope

oled.println("Failed to start!");

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void genshutdown()':

generator:318:3: error: 'oled' was not declared in this scope

oled.print("Generator");

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void testrun()':

generator:328:3: error: 'DateTime' was not declared in this scope

DateTime now = RTC.now();

^

generator:329:6: error: 'now' was not declared in this scope

if(now.day()==15 && now.hour()==12 && now.minute()==00 && TestState==LOW && GenState==LOW) { //Test the generator by starting at specified time and date

^

generator:331:5: error: 'oled' was not declared in this scope

oled.println("Running test");

^

C:\Users\Owner\Documents\Arduino\libraries\generator\generator.ino: In function 'void loop()':

generator:376:3: error: 'DateTime' was not declared in this scope

DateTime now = RTC.now();

^

generator:389:5: error: 'oled' was not declared in this scope

oled.println("Power lost");

^

generator:394:18: error: 'now' was not declared in this scope

Serial.print(now.month(), DEC);

^

generator:403:5: error: 'oled' was not declared in this scope

oled.print("Good ");

^

Multiple libraries were found for "Servo.h"
Used: C:\Users\Owner\Documents\Arduino\libraries\Servo
Not used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Servo
exit status 1
'emon1' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

generator.ino (17.9 KB)

No object named emon1, there is an emon1 defined but is defined as an int and is commented out.

Some words tossed in the code Servo ChokeServ; Why is that there.

this line #include <SSD1306AsciiAvrI2c.h> oled; Why is this like that? An include statement as well as trying to define the oled object?

These are a few issues I found with just a simple glance.

I think I am in over my head! I downloaded the code thinking I could just upload it to the Arduino, wire up the components to my Arduino and generator, and be in business, but it looks like I will have to get the fundamentals before I can get this to work. I placed the proverbial cart before the horse.

Hello All-

Happy to report that I worked out all the errors in the code and now just need to insert OLED commands back into the code!

Thanks for all your help!!