Buona sera a tutti i presenti, da neofita di arduino ringrazio e pongo una questione.
Ieri ho avuto un problema con il mio Arduino Uno, ho provato a fare un Upload ed all'improvviso mi è comparso questo messaggio di errore:
avrdude: stk500_recv(): programmer is not responding
Qualcuno saprebbe spiegarmi che cosa è successo, e se esiste una eventuale soluzione ??
(Utilizzo Arduino con MAC )
Comunque, grazie per l'interessamento.
Ho ho creato un circuito ( credo si chiami cosi ), per comandare un motore passo passo bipolare, due pulsanti per L ed R, potenziometro per regolarne la velocità, ho utilizzato arduino uno e easydriver 4.4
Ieri ho caricato lo sketch tutto funzionava correttamente. Staccato il cavo usb ieri, oggiricollegaro senza fare alcun tipo di modifica e non andava piu nulla mi dava solo quell'errore
Questo il codice:
in allegato anche i collegamenti
EasyDriver stepper test sketch
// constants won't change. They're used here to
// set pin numbers:
const byte stepUpPin = 4; // the number of the step pin
const byte stepDownPin = 5; // the number of the step pin
const byte stepOut = 2;
const byte directionOut = 3;
const byte ledPin = 12; // pin # for direction indicator LED
const byte readyPin = 11; //pin # for LED that comes on when all the steps have been completed
const byte inMotionPin = 10; // pin # for the LED that light up when the stepper is supposed to be still moving
const byte ratePin = 0; // A0 - analog 0 pin on Arduino to control the stepping dealy (i.e. RPMs)
const byte enablePin = 6; // turn EasyDriver off when not turning (saves power but ONLY use when there's no need to hold position)
// Variables will change:
byte ledState = LOW; // the current state of the output pin
byte lastStepUpButtonState = HIGH; // the previous reading from the step UP pin
byte lastStepDownButtonState = HIGH; // the previous reading from the step DOWN pin
byte directionState=HIGH; // the current direction
byte stepUpState=HIGH; // the current state of UP button
byte stepDownState=HIGH; // the current state of DOWN button
int stepsPassed = 10; //how many steps?
int stepsPassedMax = 50; // trying to calculate steps per revolution (remember the microstepping settings 1/8th is default)
// most small and micro steppers, especially those that came from a CD- or DVD-R/RW drives
// have 20 steps per revolution. So 160 mircosteps should make the motor spin 360 degrees once.
long lastStepUpDebounceTime = 0; // the last time the output pin was toggled
long lastStepDownDebounceTime = 0; // the last time the output pin was toggled
long debounceDelay = 10; // the debounce time in ms; increase if the output flickers
long stepDelayBase = 1; // 1ms base rate. Multiply by the reading from the RATE potentiometer for actual step delay
long stepDelay; //
long lastStepTime = 0; // last time the step signal was sent
void setup() {
pinMode(stepUpPin, INPUT);
pinMode(stepDownPin, INPUT);
pinMode(ratePin, INPUT);
pinMode(stepOut, OUTPUT);
pinMode(directionOut, OUTPUT);
pinMode(ledPin, OUTPUT);
pinMode(readyPin, OUTPUT);
pinMode(inMotionPin, OUTPUT);
pinMode(enablePin, OUTPUT);
digitalWrite(readyPin, HIGH); // turn OFF all LEDs in the beginning
digitalWrite(inMotionPin, HIGH); // turn OFF all LEDs in the beginning
digitalWrite(ledPin, HIGH); // turn OFF all LEDs in the beginning
}
void loop() {
// read the state of the switch into a local variable:
int readingStepUp = digitalRead(stepUpPin);
int readingStepDown = digitalRead(stepDownPin);
stepDelay = analogRead(ratePin) * stepDelayBase/50;
if(stepDelay < 1) stepDelay = 1; // reality check - a pot can read 0 and then it would mean infinite RMP - not possible
if(readingStepUp == LOW || readingStepDown == LOW) { // only read buttons if either one of them is LOW
// If the switch changed, due to noise or pressing:
if (readingStepUp != lastStepUpButtonState) {
// reset the debouncing timer
lastStepUpDebounceTime = millis();
lastStepUpButtonState = readingStepUp;
}
if ((millis() - lastStepUpDebounceTime) > debounceDelay) {
// whatever the reading is at, it's been there for longer
// than the debounce delay, so take it as the actual current state:
lastStepUpButtonState = readingStepUp;
lastStepUpDebounceTime = millis();
stepUpState = readingStepUp;
}
// If the switch changed, due to noise or pressing:
if (readingStepDown != lastStepDownButtonState) {
// reset the debouncing timer
lastStepDownDebounceTime = millis();
lastStepDownButtonState = readingStepDown;
}
if ((millis() - lastStepDownDebounceTime) > debounceDelay) {
// whatever the reading is at, it's been there for longer
// than the debounce delay, so take it as the actual current state:
lastStepDownButtonState = readingStepDown;
lastStepDownDebounceTime = millis();
stepDownState = readingStepDown;
}
}
else{
stepUpState = HIGH;
stepDownState = HIGH;
} // end of if block that reads button states
if(stepsPassed == 0 ) { // if the previous command has completed, make the direction decision
if(stepUpState == LOW || stepDownState == LOW) {
if(stepUpState == LOW && stepDownState == LOW) {
directionState = LOW;
} // why are you holding both UP and DOWN buttons?
if(stepUpState == LOW && stepDownState == HIGH) {
directionState = HIGH;
} // go up
if(stepUpState == HIGH && stepDownState == LOW) {
directionState = LOW;
} // go down
stepsPassed = stepsPassedMax+1;
}
}
if(stepsPassed > 0 ) // send step signals now
{
digitalWrite(enablePin, LOW); // wake up
digitalWrite(ledPin, directionState); // set proper direction
digitalWrite(directionOut, directionState);
if((millis() - lastStepTime) > stepDelay) // delay expired, send another step
{
digitalWrite(stepOut, HIGH);
stepsPassed--;
lastStepTime = millis();
}
else
{
// time for one step not yet expired, hold the STEP signal low
digitalWrite(stepOut, LOW);
}
}
else{
digitalWrite(enablePin, HIGH); // go to sleep
}
if(stepsPassed == 0) {
digitalWrite(readyPin, LOW);
digitalWrite(inMotionPin, HIGH);
}
else{
digitalWrite(readyPin, HIGH);
digitalWrite(inMotionPin, LOW);
}
}
Mmm ok, allora quando collego l' usb si accende il led verde ON su arduino e quello rosso su easydriver, provato alimentatore esterno, ma non cambia nulla, cambiato usb nulla anche li.
Per programmare l'Arduino devi disconnettere i cavetti dai pin 0 e 1 che sono collegati all'altra schedina. Potrebbero, anzi, sicuramente interferiscono con la programmazione. Puoi metterli sui pin 7 e 8 che mi sembrano liberi. Naturalmente dovrai modificare lo sketch di conseguenza, per dire al micro che adesso quei comandi si trovano li e non la.
EDIT:
Dalla foto sembra che almeno il pin 1 sia collegato, ma deve essere un illusione data dall'inquadratura.
EDIT:
Un altra cosa, sull'easydriver, sotto il trimmer, i cavetti Vcc e GND sembrano infilati e non saldati. Potrebbero crearti problemi di funzionamento del motore.
Grazie per la dritta PaoloP, ho controllato e i pin 0 e 1 non sono collegati, forse come dicevi tu l'illusione può far sembrare che lo siano.
Sull' easy non sono saldati al momento ma non mi danno problemi, in quanto il problema che ho io è quello di caricare gli sketch su Arduino.
Ho notato che anche se scollego il tutto e provo acnhe solo a caricare uno sketch predefinito, o base come un semplice hello world, la spia on resta verde accesa e non succede altro, non lapeggia nulla come in altre occasioni, facendomi comparire l'errore riportato.
Non vorrei che fosse più un problema di arduino che del resto, possibile ??
Se hai scollegato tutto e il problema persiste allora il colpevole potrebbe essere proprio l'Arduino.
Controlla per prima cosa se hai selezionato nell'IDE la giusta porta COM e la Board corretta nel menu strumenti.
Se hai a disposizione un'altro PC prova a scaricare e installare l'IDE anche li e prova a programmare l'Arduino col secondo PC.
Alcune volte anche io ho avuto alcuni problemi, spesso perché usavo troppo la porta seriale, un modo pratico per risolvere, oltre a fare tutti i controlli che ti hanno già suggerito e prendere il programma più semplice ovvero blinkled scollegare tutto da tuo arduino, e provare a caricare.
Un altro modo e tenere premuto il pulsante di reset lanciare l'upload e mollare il pulsante, le tempistiche non me le ricordo, ma mi è stato spiegato qui sul forum quindi se cerchi un po'.....
Almeno in questo modo vedi se la scheda e ok oppure no, se l'upload del B link l'ex e ok allora forse colleghi qualcosa in modo errato......