urgent HELP with coding

well i wasted those 300secs :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

any fixes

schneel:
IT FIXED IT

?

Get back to me after dinner - I'm done here for now.

ok

Is there any chance of you posting your full sketch as it is now and the full error messages or shall we carry on guessing ?

I guess it was that urgent after all.

Goodnight.

UKHeliBob:
Is there any chance of you posting your full sketch as it is now and the full error messages or shall we carry on guessing ?

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x9a
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: The device does not recognize the command.

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x9a
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: The device does not recognize the command.

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x9a
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: The device does not recognize the command.

avrdude: stk500_recv(): programmer is not responding
the selected serial port
does not exist or your board is not connected
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x9a
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: The device does not recognize the command.

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x9a
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: The device does not recognize the command.

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x9a
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: The device does not recognize the command.

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x9a
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: The device does not recognize the command.

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x9a
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: The device does not recognize the command.

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x9a
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: The device does not recognize the command.

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x9a
avrdude: ser_drain(): read error: The device does not recognize the command.

dunno why i was allowed t post it kept saying i passed the 9000char

So, not a programming error

Which Arduino board are you using ?
Which board have you got selected in the IDE ?

I hate that

avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x9a

which happens to me from time to time. Check the board type and port. Try a different USB port. Should not be the cable, which worked just yesterday, but what the hey, try another.

Reset the USB sub-system. (I only know to reboot my machine.)

I’ll go weeks or months with no USB trouble at all, then suffer all sorts of problems for days, I have quite a few Arduino-like things I plug and unplug.

Pro tip: keep a Terminal window open handy and enter the command line “killall avrdude” when this error starts and you will cut short the agony of watching it try and fail ten times.

That’s on MacOS, perhaps a Windows and a Linux guy can share an equivalent.

a7

UKHeliBob:
So, not a programming error

Which Arduino board are you using ?
Which board have you got selected in the IDE ?

arduino pro mini atmega 328 but really dont knowwether 5 or 3 volts

tried both in ide

TheMemberFormerlyKnownAsAWOL:
Don't use '10', use 'A'.

well

i tried again and thank god i was able to upload/test basic blinking sketch

but uploading the main sketch (that the whole post was originally about) after changing '10' to 'A'

failed giving error

:\Users\OO\AppData\Local\Temp\arduino_modified_sketch_283829\Firmware.ino: In function 'char menu()':
C:\Users\OO\AppData\Local\Temp\arduino_modified_sketch_283829\Firmware.ino:209:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^

What a shame we can't see the code.

Another 300 seconds down the drain

// 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 == 'A') {
    // 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 == 'A') 
    			Serial.println(F("Now Testing ToggleSwitch #8"));
            else
            {
                Serial.println(F("illegal input!"));
                return 0;
            }
            time0 = millis();
            return c;
        }
    }
}

dunno what u mean :o :o

simpler pls

i tried using the simulator app an removed a switch so there wasnt a '10' to replace with A

// 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



// 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);


// 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();
    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);
    }
    
    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("(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
            {
                Serial.println(F("illegal input!"));
                return 0;
            }
            time0 = millis();
            return c;
        }
    }
}

and still gave me

errors of

C:\Users\OO\AppData\Local\Temp\arduino_modified_sketch_27540\Firmware.ino: In function 'char menu()':
C:\Users\OO\AppData\Local\Temp\arduino_modified_sketch_27540\Firmware.ino:195:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
C:\Users\OO\Documents\Arduino\libraries\Firmware\Button.cpp: In member function 'bool Button::onChange()':
C:\Users\OO\Documents\Arduino\libraries\Firmware\Button.cpp:43:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ((millis() - m_lastDebounceTime) > m_debounceDelay) {

C:\Users\OO\Documents\Arduino\libraries\Firmware\Button.cpp: In member function 'bool Button::onPress()':
C:\Users\OO\Documents\Arduino\libraries\Firmware\Button.cpp:75:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ((millis() - m_lastDebounceTime) > m_debounceDelay) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
C:\Users\OO\Documents\Arduino\libraries\Firmware\Button.cpp: In member function 'bool Button::onRelease()':
C:\Users\OO\Documents\Arduino\libraries\Firmware\Button.cpp:105:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ((millis() - m_lastDebounceTime) > m_debounceDelay) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
Sketch uses 3846 bytes (12%) of program storage space. Maximum is 30720 bytes.
Global variables use 273 bytes (13%) of dynamic memory, leaving 1775 bytes for local variables. Maximum is 2048 bytes.
An error occurred while uploading the sketch
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x9a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x9a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x9a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x9a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x9a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x9a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x9a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x9a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x9a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x9a

Those are warnings not errors, but fix them anyway

how??????

anyone!!

The first warning is about your function menu(), this function is missing a return statement at the end.

The 3 other warnings are from that "Button" library that you are using, a variable should be set to type unsigned long

As said, these are just warning, and your code was compiled successfully, but for some reason it couldn't be uploaded to the board. It's not related to the code. Try install drivers for the usb-serial chip that is on your board, or try another usb cable, or search google for this "not in sync: resp=0x9a" error

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.