urgent HELP with coding

originally posted in editor section (srry)

a bit embarraced but i am no programer

i just got to arduino to make a human interface control device

any ways i am using an arduino pro mini connected to pc through a ttl usb

the board is connected to 8 toggle switches and 2 sliding potentiometers

i used https://create.arduino.cc/

giving code of

// Include Libraries
#include "Arduino.h"
#include "Potentiometer.h"
#include "Button.h"


// Pin Definitions
#define POTENTIOMETERSLIDE_5V1_1_PIN_WIPER    A0
#define POTENTIOMETERSLIDE_5V2_2_PIN_WIPER    A1
#define TOGGLESWITCH_1_PIN_2    2
#define TOGGLESWITCH_2_PIN_2    3
#define TOGGLESWITCH_3_PIN_2    4
#define TOGGLESWITCH_4_PIN_2    5
#define TOGGLESWITCH_5_PIN_2    6
#define TOGGLESWITCH_6_PIN_2    7
#define TOGGLESWITCH_7_PIN_2    8
#define TOGGLESWITCH_8_PIN_2    10



// Global variables and defines

// object initialization
Potentiometer potentiometerSlide_5v1_1(POTENTIOMETERSLIDE_5V1_1_PIN_WIPER);
Potentiometer potentiometerSlide_5v2_2(POTENTIOMETERSLIDE_5V2_2_PIN_WIPER);
Button ToggleSwitch_1(TOGGLESWITCH_1_PIN_2);
Button ToggleSwitch_2(TOGGLESWITCH_2_PIN_2);
Button ToggleSwitch_3(TOGGLESWITCH_3_PIN_2);
Button ToggleSwitch_4(TOGGLESWITCH_4_PIN_2);
Button ToggleSwitch_5(TOGGLESWITCH_5_PIN_2);
Button ToggleSwitch_6(TOGGLESWITCH_6_PIN_2);
Button ToggleSwitch_7(TOGGLESWITCH_7_PIN_2);
Button ToggleSwitch_8(TOGGLESWITCH_8_PIN_2);


// define vars for testing menu
const int timeout = 10000;       //define timeout of 10 sec
char menuOption = 0;
long time0;

// Setup the essentials for your circuit to work. It runs first every time your circuit is powered with electricity.
void setup() 
{
    // Setup Serial which is useful for debugging
    // Use the Serial Monitor to view printed messages
    Serial.begin(9600);
    while (!Serial) ; // wait for serial port to connect. Needed for native USB
    Serial.println("start");
    
    ToggleSwitch_1.init();
    ToggleSwitch_2.init();
    ToggleSwitch_3.init();
    ToggleSwitch_4.init();
    ToggleSwitch_5.init();
    ToggleSwitch_6.init();
    ToggleSwitch_7.init();
    ToggleSwitch_8.init();
    menuOption = menu();
    
}

//
 Main logic of your circuit. It defines the interaction between the 
components you selected. After setup, it runs over and over again, in an
 eternal loop.
void loop() 
{
    
    
    if(menuOption == '1') {
    // Slide Pot - X-Large (10k Linear Taper) #1 - Test Code
    int potentiometerSlide_5v1_1Val = potentiometerSlide_5v1_1.read();
    Serial.print(F("Val: ")); Serial.println(potentiometerSlide_5v1_1Val);

    }
    else if(menuOption == '2') {
    // Slide Pot - X-Large (10k Linear Taper) #2 - Test Code
    int potentiometerSlide_5v2_2Val = potentiometerSlide_5v2_2.read();
    Serial.print(F("Val: ")); Serial.println(potentiometerSlide_5v2_2Val);

    }
    else if(menuOption == '3') {
    // ToggleSwitch #1 - Test Code
    //read Toggle Switch state. 
    //if Switch is open function will return LOW (0). 
    //if it is closed function will return HIGH (1).
    bool ToggleSwitch_1Val = ToggleSwitch_1.read();
    Serial.print(F("Val: ")); Serial.println(ToggleSwitch_1Val);
    }
    else if(menuOption == '4') {
    // ToggleSwitch #2 - Test Code
    //read Toggle Switch state. 
    //if Switch is open function will return LOW (0). 
    //if it is closed function will return HIGH (1).
    bool ToggleSwitch_2Val = ToggleSwitch_2.read();
    Serial.print(F("Val: ")); Serial.println(ToggleSwitch_2Val);
    }
    else if(menuOption == '5') {
    // ToggleSwitch #3 - Test Code
    //read Toggle Switch state. 
    //if Switch is open function will return LOW (0). 
    //if it is closed function will return HIGH (1).
    bool ToggleSwitch_3Val = ToggleSwitch_3.read();
    Serial.print(F("Val: ")); Serial.println(ToggleSwitch_3Val);
    }
    else if(menuOption == '6') {
    // ToggleSwitch #4 - Test Code
    //read Toggle Switch state. 
    //if Switch is open function will return LOW (0). 
    //if it is closed function will return HIGH (1).
    bool ToggleSwitch_4Val = ToggleSwitch_4.read();
    Serial.print(F("Val: ")); Serial.println(ToggleSwitch_4Val);
    }
    else if(menuOption == '7') {
    // ToggleSwitch #5 - Test Code
    //read Toggle Switch state. 
    //if Switch is open function will return LOW (0). 
    //if it is closed function will return HIGH (1).
    bool ToggleSwitch_5Val = ToggleSwitch_5.read();
    Serial.print(F("Val: ")); Serial.println(ToggleSwitch_5Val);
    }
    else if(menuOption == '8') {
    // ToggleSwitch #6 - Test Code
    //read Toggle Switch state. 
    //if Switch is open function will return LOW (0). 
    //if it is closed function will return HIGH (1).
    bool ToggleSwitch_6Val = ToggleSwitch_6.read();
    Serial.print(F("Val: ")); Serial.println(ToggleSwitch_6Val);
    }
    else if(menuOption == '9') {
    // ToggleSwitch #7 - Test Code
    //read Toggle Switch state. 
    //if Switch is open function will return LOW (0). 
    //if it is closed function will return HIGH (1).
    bool ToggleSwitch_7Val = ToggleSwitch_7.read();
    Serial.print(F("Val: ")); Serial.println(ToggleSwitch_7Val);
    }
    else if(menuOption == '10') {
    // ToggleSwitch #8 - Test Code
    //read Toggle Switch state. 
    //if Switch is open function will return LOW (0). 
    //if it is closed function will return HIGH (1).
    bool ToggleSwitch_8Val = ToggleSwitch_8.read();
    Serial.print(F("Val: ")); Serial.println(ToggleSwitch_8Val);
    }
    
    if (millis() - time0 > timeout)
    {
        menuOption = menu();
    }
    
}



// Menu function for selecting the components to be tested
// Follow serial monitor for instrcutions
char menu()
{

    Serial.println(F("\nWhich component would you like to test?"));
    Serial.println(F("(1) Slide Pot - X-Large (10k Linear Taper) #1"));
    Serial.println(F("(2) Slide Pot - X-Large (10k Linear Taper) #2"));
    Serial.println(F("(3) ToggleSwitch #1"));
    Serial.println(F("(4) ToggleSwitch #2"));
    Serial.println(F("(5) ToggleSwitch #3"));
    Serial.println(F("(6) ToggleSwitch #4"));
    Serial.println(F("(7) ToggleSwitch #5"));
    Serial.println(F("(8) ToggleSwitch #6"));
    Serial.println(F("(9) ToggleSwitch #7"));
    Serial.println(F("(10) ToggleSwitch #8"));
    Serial.println(F("(menu) send anything else or press on board reset button\n"));
    while (!Serial.available());

    // Read data from serial monitor if received
    while (Serial.available()) 
    {
        char c = Serial.read();
        if (isAlphaNumeric(c)) 
        {   
            
            if(c == '1') 
                Serial.println(F("Now Testing Slide Pot - X-Large (10k Linear Taper) #1"));
            else if(c == '2') 
                Serial.println(F("Now Testing Slide Pot - X-Large (10k Linear Taper) #2"));
            else if(c == '3') 
                Serial.println(F("Now Testing ToggleSwitch #1"));
            else if(c == '4') 
                Serial.println(F("Now Testing ToggleSwitch #2"));
            else if(c == '5') 
                Serial.println(F("Now Testing ToggleSwitch #3"));
            else if(c == '6') 
                Serial.println(F("Now Testing ToggleSwitch #4"));
            else if(c == '7') 
                Serial.println(F("Now Testing ToggleSwitch #5"));
            else if(c == '8') 
                Serial.println(F("Now Testing ToggleSwitch #6"));
            else if(c == '9') 
                Serial.println(F("Now Testing ToggleSwitch #7"));
            else if(c == '10') 
                Serial.println(F("Now Testing ToggleSwitch #8"));
            else
            {
                Serial.println(F("illegal input!"));
                return 0;
            }
            time0 = millis();
            return c;
        }
    }
}

every time i add it to hourly or web editor and verify it gives me endless errors

i need this project ASAP
PLS help

edit

used firmware but this error was written twice

warning: multi-character character constant [-Wmultichar]
else if(menuOption == ‘10’) {
^~~~

Firmware.ino (9.52 KB)

Single quotes, single character

warning: multi-character character constant [-Wmultichar]
    else if(menuOption == '10') {

Is a warning, not an error, but the problem needs fixing

Use single quotes for single chars Use double quotes for multiple character strings

Don't mix the two

it gives me endless errors

Are you going to share the rest of the errors with us ?

Are you going to share the rest of the errors with us ?

UKHeliBob: warning: multi-character character constant [-Wmultichar]    else if(menuOption == '10') {

Is a warning, not an error, but the problem needs fixing

Use single quotes for single chars Use double quotes for multiple character strings

Don't mix the two Are you going to share the rest of the errors with us ?

what do u mean with single and doube qoutes Are you going to share the rest of the errors with us ?

i just kept trying to delete whole texts out and it gives new errors so i guess i was destroying it

single quote = ' double quote = "

" double quotes, used for strings
’ single quotes, used for single characters.

strings and chars

i dunno what r they or the difference couldu explain more

or just correct it for me

if(menuOption == ‘10’)

Point to the key on your keyboard engraved with ‘10’.

(That doesn’t have an ‘F’ in front of it)

i am srry am a slow thinker but what is that key :confused:

There isn’t one.

i mean what should i do???

1. We have in C-Language perspective -- Opening single quote key -- ' (near the Enter key of my PC) Closing single quote key -- ' (near the Enter key of my PC)

Use "opening single quote" and "closing single quote" to bound a single character in C-language declaration.

Example:

char myChar = 'A';    //myChar is the variable name (the identifier)

2. We have in C-Language perspective -- Opening double quote key -- " (near the Enter key of my PC) Closing single quote key -- " (near the Enter key of my PC)

Use "opening double quote" and "closing double quote" to bound a string (more than one characters) in C-language declaration.

Example:

char myArray[] = "ABC";    //myArray is the name of array that holds these three characters A B C and a silent null-byte (0x00).

schneel:
i mean what should i do???

You need to decide how to figure out that a ‘1’ menu character is a 1, and not the start of a 10

well then i switched to double

but i got this

In function 'void loop()': C:\Users\OO\Desktop\Firmware\Firmware.ino:136:27: warning: ISO C++ forbids comparison between pointer and integer [-fpermissive] else if(menuOption == "10") { ^~~~ C:\Users\OO\Desktop\Firmware\Firmware.ino: In function 'char menu()': C:\Users\OO\Desktop\Firmware\Firmware.ino:198:20: warning: ISO C++ forbids comparison between pointer and integer [-fpermissive] else if(c == "10") ^~~~

There are tutorials on how to handle serial input.

just lookin for a quick fix

Have you thought about my earlier question about 1 and 10?

schneel:
just lookin for a quick fix

Don’t use ‘10’, use ‘A’.

IT FIXED IT

but uploading the code gave a well long thread of errors

schneel:
but uploading the code gave a well long thread of errors

Thoughts and prayers.

You have to wait five minutes between posts.

Don’t waste those 300 seconds.