I'm having trouble troubleshooting my IDE C++ code as you can probably tell I'm fairly new to coding and don't have much experience so would help if someone could help troubleshoot this for me. In case you're wondering I'm using PWM to control a DC motor
```cpp
//#include <LiquidCrystal.h>
#include <LCDKeypad.h>
LCDKeypad lcd;
// Define keycodes
#define None 0
//#define Select 1
#define Left 4
#define Up 2
#define Down 3
//#define Right 5
//float pwm_value=50;
// Pin for analog keypad
#define diy_pwm A2 //was A2
// PWM output pin
#define pwm 3
// Motor direction pin
#define dir 2
// Variable to represent PWM value
int pwm_value = 20;
void setup() {
// Setup LCD
lcd.begin(16, 2);
lcd.clear();
// Define Pins
pinMode(pwm, OUTPUT);
pinMode(dir, OUTPUT);
TCCR2B = TCCR2B & B11111000 | 0x01; //B00000010;
}
void loop() {
while (1) {
// Scan keypad to determine which button was pressed
// Toggle motor direction if LEFT button pressed
if (lcd.button() == Left) {
digitalWrite(dir, !digitalRead(dir));
delay(200);
}
// Increase motor speed if UP button pressed
if (lcd.button() == Up) {
//pwm_value++;
pwm_value = pwm_value + 5;
delay(200);
lcd.clear();
}
// Decrease motor speed if DOWN button pressed
else if (lcd.button() == Down) {
//pwm_value--;
pwm_value = pwm_value - 5;
delay(200);
lcd.clear();
}
// Ensure PWM value ranges from 0 to 255
if (pwm_value > 255)
pwm_value = 255;
else if (pwm_value < 0)
pwm_value = 0;
// Send PWM to output pin
analogWrite(pwm, pwm_value);
// Display results on LCD
lcd.setCursor(0, 0);
lcd.print("PWM:");
lcd.print(pwm_value);
lcd.setCursor(0, 1);
lcd.print("DIR:");
lcd.print(digitalRead(dir));
}
}
**THESE ARE ERROR MESSAGES**
C:\Users\bandg\Downloads\mycytron\mycytron.ino: In function 'void setup()':
C:\Users\bandg\Downloads\mycytron\mycytron.ino:31:18: error: no matching function for call to 'LCDKeypad::begin(int, int)'
lcd.begin(16, 2);
^
In file included from C:\Users\bandg\Downloads\mycytron\mycytron.ino:3:0:
C:\Users\bandg\OneDrive\Documents\Arduino\libraries\TGP_LCD_Keypad/LCDKeypad.h:50:8: note: candidate: void LCDKeypad::begin(int)
void begin(int eepromAddress = EEPPROM_ADDRESS_DEFAULT);
^~~~~
C:\Users\bandg\OneDrive\Documents\Arduino\libraries\TGP_LCD_Keypad/LCDKeypad.h:50:8: note: candidate expects 1 argument, 2 provided
C:\Users\bandg\Downloads\mycytron\mycytron.ino:32:7: error: 'class LCDKeypad' has no member named 'clear'
lcd.clear();
^~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino: In function 'void loop()':
C:\Users\bandg\Downloads\mycytron\mycytron.ino:46:13: error: 'class LCDKeypad' has no member named 'button'
if (lcd.button() == Left) {
^~~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:52:13: error: 'class LCDKeypad' has no member named 'button'
if (lcd.button() == Up) {
^~~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:56:11: error: 'class LCDKeypad' has no member named 'clear'
lcd.clear();
^~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:60:18: error: 'class LCDKeypad' has no member named 'button'
else if (lcd.button() == Down) {
^~~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:64:11: error: 'class LCDKeypad' has no member named 'clear'
lcd.clear();
^~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:77:9: error: 'class LCDKeypad' has no member named 'setCursor'
lcd.setCursor(0, 0);
^~~~~~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:78:9: error: 'class LCDKeypad' has no member named 'print'
lcd.print("PWM:");
^~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:79:9: error: 'class LCDKeypad' has no member named 'print'
lcd.print(pwm_value);
^~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:80:9: error: 'class LCDKeypad' has no member named 'setCursor'
lcd.setCursor(0, 1);
^~~~~~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:81:9: error: 'class LCDKeypad' has no member named 'print'
lcd.print("DIR:");
^~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:82:9: error: 'class LCDKeypad' has no member named 'print'
lcd.print(digitalRead(dir));
^~~~~
Multiple libraries were found for "LiquidCrystal.h"
Used: C:\Users\bandg\OneDrive\Documents\Arduino\libraries\LiquidCrystal
Not used: C:\Users\bandg\AppData\Local\Arduino15\libraries\LiquidCrystal
exit status 1
Compilation error: no matching function for call to 'LCDKeypad::begin(int, int)'
I'm fairly new to coding and am trying to use PWM to control a DC motor but these error messages keep coming up for this code and I can't figure out how to solve it if anyone could help me that would be great thanks
//#include <LiquidCrystal.h>
#include <LCDKeypad.h>
LCDKeypad lcd;
// Define keycodes
#define None 0
//#define Select 1
#define Left 4
#define Up 2
#define Down 3
//#define Right 5
//float pwm_value=50;
// Pin for analog keypad
#define diy_pwm A2 //was A2
// PWM output pin
#define pwm 3
// Motor direction pin
#define dir 2
// Variable to represent PWM value
int pwm_value = 20;
void setup() {
// Setup LCD
lcd.begin(16, 2);
lcd.clear();
// Define Pins
pinMode(pwm, OUTPUT);
pinMode(dir, OUTPUT);
TCCR2B = TCCR2B & B11111000 | 0x01; //B00000010;
}
void loop() {
while (1) {
// Scan keypad to determine which button was pressed
// Toggle motor direction if LEFT button pressed
if (lcd.button() == Left) {
digitalWrite(dir, !digitalRead(dir));
delay(200);
}
// Increase motor speed if UP button pressed
if (lcd.button() == Up) {
//pwm_value++;
pwm_value = pwm_value + 5;
delay(200);
lcd.clear();
}
// Decrease motor speed if DOWN button pressed
else if (lcd.button() == Down) {
//pwm_value--;
pwm_value = pwm_value - 5;
delay(200);
lcd.clear();
}
// Ensure PWM value ranges from 0 to 255
if (pwm_value > 255)
pwm_value = 255;
else if (pwm_value < 0)
pwm_value = 0;
// Send PWM to output pin
analogWrite(pwm, pwm_value);
// Display results on LCD
lcd.setCursor(0, 0);
lcd.print("PWM:");
lcd.print(pwm_value);
lcd.setCursor(0, 1);
lcd.print("DIR:");
lcd.print(digitalRead(dir));
}
}
ERROR MESSAGES
C:\Users\bandg\Downloads\mycytron\mycytron.ino: In function 'void setup()':
C:\Users\bandg\Downloads\mycytron\mycytron.ino:31:18: error: no matching function for call to 'LCDKeypad::begin(int, int)'
lcd.begin(16, 2);
^
In file included from C:\Users\bandg\Downloads\mycytron\mycytron.ino:3:0:
C:\Users\bandg\OneDrive\Documents\Arduino\libraries\TGP_LCD_Keypad/LCDKeypad.h:50:8: note: candidate: void LCDKeypad::begin(int)
void begin(int eepromAddress = EEPPROM_ADDRESS_DEFAULT);
^~~~~
C:\Users\bandg\OneDrive\Documents\Arduino\libraries\TGP_LCD_Keypad/LCDKeypad.h:50:8: note: candidate expects 1 argument, 2 provided
C:\Users\bandg\Downloads\mycytron\mycytron.ino:32:7: error: 'class LCDKeypad' has no member named 'clear'
lcd.clear();
^~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino: In function 'void loop()':
C:\Users\bandg\Downloads\mycytron\mycytron.ino:46:13: error: 'class LCDKeypad' has no member named 'button'
if (lcd.button() == Left) {
^~~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:52:13: error: 'class LCDKeypad' has no member named 'button'
if (lcd.button() == Up) {
^~~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:56:11: error: 'class LCDKeypad' has no member named 'clear'
lcd.clear();
^~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:60:18: error: 'class LCDKeypad' has no member named 'button'
else if (lcd.button() == Down) {
^~~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:64:11: error: 'class LCDKeypad' has no member named 'clear'
lcd.clear();
^~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:77:9: error: 'class LCDKeypad' has no member named 'setCursor'
lcd.setCursor(0, 0);
^~~~~~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:78:9: error: 'class LCDKeypad' has no member named 'print'
lcd.print("PWM:");
^~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:79:9: error: 'class LCDKeypad' has no member named 'print'
lcd.print(pwm_value);
^~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:80:9: error: 'class LCDKeypad' has no member named 'setCursor'
lcd.setCursor(0, 1);
^~~~~~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:81:9: error: 'class LCDKeypad' has no member named 'print'
lcd.print("DIR:");
^~~~~
C:\Users\bandg\Downloads\mycytron\mycytron.ino:82:9: error: 'class LCDKeypad' has no member named 'print'
lcd.print(digitalRead(dir));
^~~~~
Multiple libraries were found for "LiquidCrystal.h"
Used: C:\Users\bandg\OneDrive\Documents\Arduino\libraries\LiquidCrystal
Not used: C:\Users\bandg\AppData\Local\Arduino15\libraries\LiquidCrystal
exit status 1
Compilation error: no matching function for call to 'LCDKeypad::begin(int, int)'
Perfect that solved most of the issues. The remaining error messages that are still occurring are these: If you could troubleshoot these mate that would be so unbelievably helpful thanks
i.e the code is the same as it was in the above post
C:\Users\bandg\Downloads\mycytron\mycytron.ino:3:10: fatal error: LCDKeypad.h: No such file or directory
#include <LCDKeypad.h>
^~~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: LCDKeypad.h: No such file or directory
Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.
Repeated cross-posting can result in a suspension from the forum.
In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.
I installed that and changed the folder preference but the same error message is still showing
HERE IS THE CODE
```cpp
#include <LiquidCrystal.h>
#include <LCDKeypad.h>
LCDKeypad lcd;
// Define keycodes
#define None 0
//#define Select 1
#define Left 4
#define Up 2
#define Down 3
//#define Right 5
//float pwm_value=50;
// Pin for analog keypad
#define diy_pwm A2 //was A2
// PWM output pin
#define pwm 3
// Motor direction pin
#define dir 2
// Variable to represent PWM value
int pwm_value = 20;
void setup() {
// Setup LCD
lcd.begin(16, 2);
lcd.clear();
// Define Pins
pinMode(pwm, OUTPUT);
pinMode(dir, OUTPUT);
TCCR2B = TCCR2B & B11111000 | 0x01; //B00000010;
}
void loop() {
while (1) {
// Scan keypad to determine which button was pressed
// Toggle motor direction if LEFT button pressed
if (lcd.button() == Left) {
digitalWrite(dir, !digitalRead(dir));
delay(200);
}
// Increase motor speed if UP button pressed
if (lcd.button() == Up) {
//pwm_value++;
pwm_value = pwm_value + 5;
delay(200);
lcd.clear();
}
// Decrease motor speed if DOWN button pressed
else if (lcd.button() == Down) {
//pwm_value--;
pwm_value = pwm_value - 5;
delay(200);
lcd.clear();
}
// Ensure PWM value ranges from 0 to 255
if (pwm_value > 255)
pwm_value = 255;
else if (pwm_value < 0)
pwm_value = 0;
// Send PWM to output pin
analogWrite(pwm, pwm_value);
// Display results on LCD
lcd.setCursor(0, 0);
lcd.print("PWM:");
lcd.print(pwm_value);
lcd.setCursor(0, 1);
lcd.print("DIR:");
lcd.print(digitalRead(dir));
}
}
THIS IS THE ERROR
C:\Users\bandg\AppData\Local\Temp\.arduinoIDE-unsaved2023015-21616-1tpbn05.dfi6\sketch_jan15a\sketch_jan15a.ino:2:10: fatal error: LCDKeypad.h: No such file or directory
#include <LCDKeypad.h>
^~~~~~~~~~~~~
compilation terminated.
Multiple libraries were found for "LiquidCrystal.h"
Used: C:\Users\bandg\OneDrive\Desktop\Arduino Default Folder\libraries\LiquidCrystal
Not used: C:\Users\bandg\AppData\Local\Arduino15\libraries\LiquidCrystal
exit status 1
Compilation error: LCDKeypad.h: No such file or directory
Yeah I really don't know anymore now it's just coming up with error staus 1. I'm so done with this. This is the code:
I've got this same problem and I can't figure it out. I have the most recent version of IDE installed as well. I'm trying to use PWM to control a DC motor. This is my code and I can't work out how to get rid of the exit status 1 error so it can compile. I've installed all the libraries necessary as far as I am aware but I can't figure it out. If someone could help that would be great thanks
THIS IS THE CODE
#include <LiquidCrystal.h>
#include "LCDKeypad.h";
LCDKeypad lcd;
// Define keycodes
#define None 0
//#define Select 1
#define Left 4
#define Up 2
#define Down 3
//#define Right 5
//float pwm_value=50;
// Pin for analog keypad
#define diy_pwm A2 //was A2
// PWM output pin
#define pwm 3
// Motor direction pin
#define dir 2
// Variable to represent PWM value
int pwm_value = 20;
void setup() {
// Setup LCD
lcd.begin(16, 2);
lcd.clear();
// Define Pins
pinMode(pwm, OUTPUT);
pinMode(dir, OUTPUT);
TCCR2B = TCCR2B & B11111000 | 0x01; //B00000010;
}
void loop() {
while (1) {
// Scan keypad to determine which button was pressed
// Toggle motor direction if LEFT button pressed
if (lcd.button() == Left) {
digitalWrite(dir, !digitalRead(dir));
delay(200);
}
// Increase motor speed if UP button pressed
if (lcd.button() == Up) {
//pwm_value++;
pwm_value = pwm_value + 5;
delay(200);
lcd.clear();
}
// Decrease motor speed if DOWN button pressed
else if (lcd.button() == Down) {
//pwm_value--;
pwm_value = pwm_value - 5;
delay(200);
lcd.clear();
}
// Ensure PWM value ranges from 0 to 255
if (pwm_value > 255)
pwm_value = 255;
else if (pwm_value < 0)
pwm_value = 0;
// Send PWM to output pin
analogWrite(pwm, pwm_value);
// Display results on LCD
lcd.setCursor(0, 0);
lcd.print("PWM:");
lcd.print(pwm_value);
lcd.setCursor(0, 1);
lcd.print("DIR:");
lcd.print(digitalRead(dir));
}
}
THIS IS THE ERROR CODE
In file included from c:\Users\bandg\OneDrive\Desktop\Arduino Default Folder\Random\libraries\TGP_LCD_Keypad/LCDKeypad.h:9:0,
from C:\Users\bandg\OneDrive\Desktop\LCD SCREEN\LCD SCREEN.ino:2:
c:\Users\bandg\OneDrive\Desktop\Arduino Default Folder\Random\libraries\TGP_LCD_Keypad/BoutonLCD.h:4:10: fatal error: BoutonBase.h: No such file or directory
#include "BoutonBase.h"
^~~~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: exit status 1
I've got this same problem and I can't figure it out. I have the most recent version of IDE installed as well. I'm trying to use PWM to control a DC motor. This is my code and I can't work out how to get rid of the exit status 1 error so it can compile. I've installed all the libraries necessary as far as I am aware but I can't figure it out. If someone could help that would be great thanks
THIS IS THE CODE
#include <LiquidCrystal.h>
#include "LCDKeypad.h";
LCDKeypad lcd;
// Define keycodes
#define None 0
//#define Select 1
#define Left 4
#define Up 2
#define Down 3
//#define Right 5
//float pwm_value=50;
// Pin for analog keypad
#define diy_pwm A2 //was A2
// PWM output pin
#define pwm 3
// Motor direction pin
#define dir 2
// Variable to represent PWM value
int pwm_value = 20;
void setup() {
// Setup LCD
lcd.begin(16, 2);
lcd.clear();
// Define Pins
pinMode(pwm, OUTPUT);
pinMode(dir, OUTPUT);
TCCR2B = TCCR2B & B11111000 | 0x01; //B00000010;
}
void loop() {
while (1) {
// Scan keypad to determine which button was pressed
// Toggle motor direction if LEFT button pressed
if (lcd.button() == Left) {
digitalWrite(dir, !digitalRead(dir));
delay(200);
}
// Increase motor speed if UP button pressed
if (lcd.button() == Up) {
//pwm_value++;
pwm_value = pwm_value + 5;
delay(200);
lcd.clear();
}
// Decrease motor speed if DOWN button pressed
else if (lcd.button() == Down) {
//pwm_value--;
pwm_value = pwm_value - 5;
delay(200);
lcd.clear();
}
// Ensure PWM value ranges from 0 to 255
if (pwm_value > 255)
pwm_value = 255;
else if (pwm_value < 0)
pwm_value = 0;
// Send PWM to output pin
analogWrite(pwm, pwm_value);
// Display results on LCD
lcd.setCursor(0, 0);
lcd.print("PWM:");
lcd.print(pwm_value);
lcd.setCursor(0, 1);
lcd.print("DIR:");
lcd.print(digitalRead(dir));
}
}
THIS IS THE ERROR CODE
In file included from c:\Users\bandg\OneDrive\Desktop\Arduino Default Folder\Random\libraries\TGP_LCD_Keypad/LCDKeypad.h:9:0,
from C:\Users\bandg\OneDrive\Desktop\LCD SCREEN\LCD SCREEN.ino:2:
c:\Users\bandg\OneDrive\Desktop\Arduino Default Folder\Random\libraries\TGP_LCD_Keypad/BoutonLCD.h:4:10: fatal error: BoutonBase.h: No such file or directory
#include "BoutonBase.h"
^~~~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: exit status 1