Veneto
Offline
Jr. Member
Karma: 1
Posts: 98
|
 |
« on: August 30, 2011, 03:15:50 pm » |
Ciao a tutti, ho un problema con il mio intervaluino. Cerco di caricare questo codice // Intervaluino // this code programs the Arduino as an intervalometer for a Canon EOS camera, using two relays and a push button // this enables you to create time-lapse movies with your camera. // change the variables “full_time” and “short_time” to automatically calculate the right time interval (based on 25 frames per second) // upload the code via USB, fire up the Arduino, plug it into your camera’s remote shutter release, and press the Intervaluino push button. // press the button another time to stop the sequence (doesn’t work that well if your interval is long) // make sure to turn on single shoot // (c) Lord Yo 2008 (intervaluino a_t sporez do:t com) // Licensed under a Creative Commons (Attribution Non-Commercial Share-Alike) license
/////////// Change these variables according to your needs
long full_time = 14400; //full length time to cover (in seconds) long short_time = 120; //length of time-lapse movie (in seconds)
int shutter_on = 200; //time to press shutter, set between 100 and 300 int shutter_wait = 5000; //initial time to wait to begin sequence int wakeup = 300; //time to activate wakeup (focus) int wakewait =200; //time between wake and shutter
/////////// Further Variables ////////////
long shutter_off = (40 * full_time / short_time) – shutter_on – wakeup – wakewait; //time to wait between shutter releases;
int outpin = 11; //output for shutter relay from pin 11 int wakepin = 8; //output for focus relay from pin 8 int switchpin = 2; //input from button from pin 2
int val; //value of button press int buttonState; //check variable for change of button press int on_off = 0; //state of sequence (turned on, turned off)
/////////// Setup ////////////
void setup() { pinMode(outpin, OUTPUT); //outpin gives output pinMode(switchpin, INPUT); //switchpin receives input pinMode(wakepin, OUTPUT); //wakepin gives output
buttonState = digitalRead(switchpin); //read value of the button }
/////////// Loop ////////////
void loop(){
val = digitalRead(switchpin); // read button value and store it in val
if (val != buttonState) { // if the button state has changed… if (val == LOW) { // check if the button is pressed… if (on_off == 0) { // if the sequence is currently off… on_off = 1; // turn the sequence on delay(shutter_wait); // wait the initial period } else { on_off = 0; // turn the sequence off } } }
buttonState = val; //switch the button state
if (on_off == 1) { //while the sequence is turned on…
digitalWrite(wakepin, HIGH); //turn wakeup/focus on delay(wakeup); //keep focus digitalWrite(wakepin, LOW); //turn wakeup off delay(wakewait); //wait digitalWrite(outpin, HIGH); //press the shutter delay(shutter_on); //wait the shutter release time digitalWrite(outpin, LOW); //release shutter delay(shutter_off); //wait for next round }
} Ma mi riporta l'errore intervaluino:22: error: stray '\' in program intervaluino:22: error: stray '\' in program intervaluino:22: error: stray '\' in program intervaluino:22: error: expected ',' or ';' before 'u2013'
non so cosa voglia dire. In più in non riesco a caricare lo sketch e mi da l'errore Binary sketch size: 1728 bytes (of a 30720 byte maximum) avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51 Cosa vuol dire? Posto qualche foto nel caso fossero utili. Grazie
|
|
|
|
|
Logged
|
|
|
|
|
Senago - Milano
Offline
God Member
Karma: 3
Posts: 507
Arduino rocks
|
 |
« Reply #1 on: August 30, 2011, 03:46:00 pm » |
il problema sta alla riga 22, cioè : long shutter_off = (40 * full_time / short_time) – shutter_on – wakeup – wakewait; //time to wait between shutter releases; ma onestamente le sto provando tutte per capire il motivo per cui non vuole digerire questo calcolo, ma non ne vengo fuori..
|
|
|
|
|
Logged
|
|
|
|
|
Forum Moderator
Italy
Offline
Brattain Member
Karma: 219
Posts: 16547
Don't know what I do
|
 |
« Reply #2 on: August 30, 2011, 03:53:48 pm » |
Mettendo così va: long full_time = 14400; //full length time to cover (in seconds) long short_time = 120; //length of time-lapse movie (in seconds)
int shutter_on = 200; //time to press shutter, set between 100 and 300 int shutter_wait = 5000; //initial time to wait to begin sequence int wakeup = 300; //time to activate wakeup (focus) int wakewait =200; //time between wake and shutter
long shutter_off; //time to wait between shutter releases;
int outpin = 11; //output for shutter relay from pin 11 int wakepin = 8; //output for focus relay from pin 8 int switchpin = 2; //input from button from pin 2
int val; //value of button press int buttonState; //check variable for change of button press int on_off = 0; //state of sequence (turned on, turned off)
/////////// Setup ////////////
void setup() { pinMode(outpin, OUTPUT); //outpin gives output pinMode(switchpin, INPUT); //switchpin receives input pinMode(wakepin, OUTPUT); //wakepin gives output shutter_off=(40 * full_time); shutter_off/=short_time; shutter_off-=shutter_on; shutter_off-=wakeup; shutter_off-=wakewait; buttonState = digitalRead(switchpin); //read value of the button }
shutter_off-=wakewait; Forse troppe operazioni su una singola riga
|
|
|
|
|
Logged
|
|
|
|
|
Senago - Milano
Offline
God Member
Karma: 3
Posts: 507
Arduino rocks
|
 |
« Reply #3 on: August 30, 2011, 04:05:21 pm » |
trovato !!!prova a sostituire la riga incriminata con questo: long shutter_off = (40 * full_time / short_time) - shutter_on - wakeup - wakewait; //time to wait between shutter releases; Anche se all'apparenza è identico, ho riscritto i meno !! praticamente il carattere ascii (forse unicode) non era quello del meno standard, ma il compilatore non lo interpretava come meno, andando ad incasinare tutto !! vedi che succede a fare copia-incolla !?
|
|
|
|
|
Logged
|
|
|
|
|
BZ (I)
Offline
Brattain Member
Karma: 162
Posts: 15760
+39 349 2158303
|
 |
« Reply #4 on: August 30, 2011, 04:18:37 pm » |
Penso che sia quello. I "meno" del codice sono 0x96 mentre i "meno" scritto da tastiera sono 0x2d. Ciao Uwe
|
|
|
|
|
Logged
|
|
|
|
|
Veneto
Offline
Jr. Member
Karma: 1
Posts: 98
|
 |
« Reply #5 on: August 30, 2011, 04:25:29 pm » |
E' quello...però adesso mi da questo Binary sketch size: 1800 bytes (of a 30720 byte maximum) avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
|
|
|
|
|
Logged
|
|
|
|
|
Forum Moderator
Italy
Offline
Brattain Member
Karma: 219
Posts: 16547
Don't know what I do
|
 |
« Reply #6 on: August 30, 2011, 04:27:38 pm » |
Quello è un errore di avrdude, forse un errato collegamento. Stai programmando un Atmega standalone o l'Arduino?
|
|
|
|
|
Logged
|
|
|
|
|
Senago - Milano
Offline
God Member
Karma: 3
Posts: 507
Arduino rocks
|
 |
« Reply #7 on: August 30, 2011, 04:28:35 pm » |
hai controllato di avere impostato la com giusta? hai impostato l'arduino corretto in tools->boards? che ne pensi di questo intervallometro??
|
|
|
|
|
Logged
|
|
|
|
|
Forum Moderator
Italy
Offline
Brattain Member
Karma: 219
Posts: 16547
Don't know what I do
|
 |
« Reply #8 on: August 30, 2011, 04:30:31 pm » |
Che prodottaccio... fatto malissimo... ma chi l'ha assemblato? Uno che aveva bevuto un paio di grappini? SCHERZO 
|
|
|
|
|
Logged
|
|
|
|
|
Senago - Milano
Offline
God Member
Karma: 3
Posts: 507
Arduino rocks
|
 |
« Reply #9 on: August 30, 2011, 04:33:40 pm » |
uffa, dai, già nel post invece di beccarmi gente interessata mi sono beccato solo criticoni solo perchè ho pasticciato con l'attiny.. almeno lasciami fare dello spam mirato con chi potrebbe essere interessato !! 
|
|
|
|
|
Logged
|
|
|
|
|
Forum Moderator
Italy
Offline
Brattain Member
Karma: 219
Posts: 16547
Don't know what I do
|
 |
« Reply #10 on: August 30, 2011, 04:36:29 pm » |
uffa, dai, già nel post invece di beccarmi gente interessata mi sono beccato solo criticoni solo perchè ho pasticciato con l'attiny..
Ma perché con gli Attiny non hai chiesto al gran maestro, cioè a me!  almeno lasciami fare dello spam mirato con chi potrebbe essere interessato !!  Tu? Spam mirato?  Anche qui devi imparare dal signore supremo dello spam incastolato e pronto al consumo diretto 
|
|
|
|
|
Logged
|
|
|
|
|
Veneto
Offline
Jr. Member
Karma: 1
Posts: 98
|
 |
« Reply #11 on: August 30, 2011, 04:47:04 pm » |
Già visto quell'intervallometro e il mio si avvicina parecchio.
Ho controllato tutto 10 volte ed è tutto ok. Potrebbe essere un problema sulla componentistica? Per non saper ne leggere ne scrivere ho cambiato anche il micro alla scheda ma niente. E' alimetato ma quando riceve i dati il led rosso non si accende
|
|
|
|
|
Logged
|
|
|
|
|
Forum Moderator
Italy
Offline
Brattain Member
Karma: 219
Posts: 16547
Don't know what I do
|
 |
« Reply #12 on: August 30, 2011, 04:51:59 pm » |
Ehm... riformula la domanda: stai programmando un chip standalone o un Arduino? Nel primo caso, quale chip? Non è che hai impostato dei fuse sul micro? Hai programmato altre volte quel micro prima di ora?
|
|
|
|
|
Logged
|
|
|
|
|
BZ (I)
Offline
Brattain Member
Karma: 162
Posts: 15760
+39 349 2158303
|
 |
« Reply #13 on: August 30, 2011, 05:36:16 pm » |
Se hai un Arduino hai collegato qualcosa ai PinDigitali 0 e 1 ? Ciao Uwe
|
|
|
|
|
Logged
|
|
|
|
|
Veneto
Offline
Jr. Member
Karma: 1
Posts: 98
|
 |
« Reply #14 on: August 31, 2011, 11:37:19 am » |
Rispondo ad entrambi, programmo direttamente su arduino e l'ho fatto un sacco di volte così ed ha sempre funzionato. Tutti i pin sono liberi. Che cosa sono dei fuse sul micro?
|
|
|
|
|
Logged
|
|
|
|
|
|