Noobie precisa de umas dicas

Boa noite,

Sou iniciante e tenho poucos conhecimentos em programação. Estou a fazer um projecto pessoal que gostava de terminar mas nao consigo compilar pois aparecem e varios erros.

Alguem pode ajudar?

Sem ver o código penso que não.

Tento por o codigo mas diz que exede o limite de caracteres...

Aqui fica o erro:

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "Arduino Uno"
In file included from sketch_feb02b.ino:26:
C:\Users\Portatil\Documents\Arduino\libraries\Button/Button.h:23:22: error: WProgram.h: No such file or directory
In file included from sketch_feb02b.ino:26:
C:\Users\Portatil\Documents\Arduino\libraries\Button/Button.h:34: error: 'LOW' was not declared in this scope
In file included from sketch_feb02b.ino:28:
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:18: error: 'byte' does not name a type
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h: In member function 'void EEPROMVar<T>::save()':
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:61: error: 'byte' does not name a type
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:65: error: 'byte' was not declared in this scope
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:65: error: expected `;' before 'i'
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:65: error: 'i' was not declared in this scope
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h: In member function 'void EEPROMVar<T>::restore()':
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:71: error: 'byte' was not declared in this scope
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:71: error: expected `;' before 'init'
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:73: error: 'init' was not declared in this scope
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:77: error: 'byte' does not name a type
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:81: error: expected `;' before 'i'
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:81: error: 'i' was not declared in this scope
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:87: error: 'byte' does not name a type
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:90: error: expected `;' before 'i'
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:90: error: 'i' was not declared in this scope
sketch_feb02b.ino: In function 'void setDate(byte, byte, byte, byte, byte, byte, byte)':
sketch_feb02b:139: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

sketch_feb02b:140: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

sketch_feb02b:141: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

sketch_feb02b:142: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

sketch_feb02b:143: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

sketch_feb02b:144: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

sketch_feb02b:145: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

sketch_feb02b:146: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

sketch_feb02b.ino: In function 'void getDate(byte*, byte*, byte*, byte*, byte*, byte*, byte*)':
sketch_feb02b:160: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

sketch_feb02b:163: error: 'class TwoWire' has no member named 'receive'

As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.

sketch_feb02b:164: error: 'class TwoWire' has no member named 'receive'

As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.

sketch_feb02b:165: error: 'class TwoWire' has no member named 'receive'

As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.

sketch_feb02b:166: error: 'class TwoWire' has no member named 'receive'

As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.

sketch_feb02b:167: error: 'class TwoWire' has no member named 'receive'

As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.

sketch_feb02b:168: error: 'class TwoWire' has no member named 'receive'

As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.

sketch_feb02b:169: error: 'class TwoWire' has no member named 'receive'

As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.

C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h: In member function 'void EEPROMVar<T>::restore() [with T = int]':
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:22:   instantiated from 'EEPROMVar<T>::EEPROMVar(T) [with T = int]'
sketch_feb02b.ino:72:   instantiated from here
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:73: error: 'IS_INITIALIZED' is not a member of 'EEPROMVar<int>'
C:\Users\Portatil\Documents\Arduino\libraries\EEPROMVar/EEPROMVar.h:75: error: 'IS_INITIALIZED' is not a member of 'EEPROMVar<int>'

O código pode ser anexado (atteched). Aparece uma opção no fim do da caixa de resposta (quando se clica a opção reply - na caixa de resposta rápida, o fundo da página não aparece).

Ok, aqui vai! :wink:

codigo typhoon.txt (20.5 KB)

De onde tiraste essa biblioteca? Assim de repente parece-me que essa biblioteca funcionava com a versao anterior do Arduino...

Tirei do tal projecto que estou a seguir. Já me disseram para instalar outra versão do Arduino, mais antiga, pode ser que resolva. Assim que chegar a casa vou experimentar.

Instalei a versao 0018 e ja consegui compilar. Mas agora o problema é outro. Quando tento fazer o upload pro arduio dá-me o seguinte erro:

avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

Pelo o que andei a pesquisar, isto deve-se ao pc nao estar a conseguir comunicar com o arduino. Entao descobri que nas opçoes do programa para escolher a board nao aparece o meu arduino (UNO) Uma vez que este codigo foi escrito para um Arduino Duemilanove ATMEGA 168 chip, haverá maneira de alterar o codigo para que fique funcional no UNO, ou outro tipo de soluçao?

Nunca trabalhei com essa versão por isso não sei qual é que pode ser o problema. O projecto não pode ser alterado para funcionar com uma versão mais moderna do IDE?

Ou mudas o codigo para funcionar com esta versão ou utilizas uma board semelhante. Que board tens escolhida agora? De onde tiraste essa biblioteca?

Nao me importo de mudar o projecto, desde que seja funcional e faça aquilo que pretendo.Haverá por aqui alguem que me possa ensinar como alterar o codigo para usar com o Arduino UNO? È fácil? ou simplesmente será mais facil arranjar uma bord igual ao do projecto?

Algumas definições, o problema nao e o Arduino UNO. O problema esta na IDE (O programa onde escreves o codigo) porque a medida que vao lançando versões novas, vão alterando as bibliotecas e o software deixa de funcionar.

A placa do Uno apareceu por volta da IDE versão 1.0, daí que não apareça no menu.

Outra opção que me ocorreu agora e tirares o ficheiro com as definições do Uno da IDE mais recente que tens e colocares na IDE versão 18. Ao reiniciares a aplicação, vai aparecer-te uma nova placa. Isto poderá funcionar... mas não é garantido. O ficheiro que tens de copiar é o boards.txt... existem diferenças como a velocidade que upload que explicam este erro. Experimenta... nunca se sabe.

Eu fiz duas questões que não foram respondidas... se mas respondesses talvez pudesse ajudar um pouco mais.

Esse Arduino funciona com a 1.0?

Eu ontem à noite estive a olhar para o código, e não me pareceu muito difícil de alterar. Se não me recordo mal, o problema eram os métodos send/receive da biblioteca Wire.h. Se até lá o problema não estiver resolvido, logo à noite posso tentar fazer as alterações necessárias.

Desde já obrigado pelas ajudas, e pela disponibilidade. Logo vou tentar experimentar trocar os ficheiros entao. Em relaçao as perguntas, ja tinha respondido que a bibliotecas foram tiradas do projecto que estou a tentar fazer. (está no codigo que postei) na 19º e 20º linha. Em relaçao á bord que tenho selecionada neste momento é a arduino bt, mas ja tentei todas sem resultado...

bubulindo:
Outra opção que me ocorreu agora e tirares o ficheiro com as definições do Uno da IDE mais recente que tens e colocares na IDE versão 18. Ao reiniciares a aplicação, vai aparecer-te uma nova placa. Isto poderá funcionar… mas não é garantido.
O ficheiro que tens de copiar é o boards.txt… existem diferenças como a velocidade que upload que explicam este erro. Experimenta… nunca se sabe.

Tentei fazer … deu para compilar, mas apos uploadar dá o seguinte erro :

avrdude: Can't find programmer id "arduino"

Valid programmers are:
  dasa3    = serial port banging, reset=!dtr sck=rts mosi=txd miso=cts [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:776]
  dasa     = serial port banging, reset=rts sck=dtr mosi=txd miso=cts [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:763]
  siprog   = Lancos SI-Prog <http://www.lancos.com/siprogsch.html> [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:750]
  ponyser  = design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:737]
  frank-stk200 = Frank STK200                   [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:702]
  blaster  = Altera ByteBlaster             [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:689]
  ere-isp-avr = ERE ISP-AVR <http://www.ere.co.th/download/sch050713.pdf> [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:679]
  atisp    = AT-ISP V1.1 programming cable for AVR-SDK1 from <http://micro-research.co.th/>  [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:669]
  dapa     = Direct AVR Parallel Access cable [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:658]
  xil      = Xilinx JTAG cable              [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:645]
  futurlec = Futurlec.com programming cable. [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:628]
  abcmini  = ABCmini Board, aka Dick Smith HOTCHIP [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:618]
  picoweb  = Picoweb Programming Cable, http://www.picoweb.net/ [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:608]
  sp12     = Steve Bolt's Programmer        [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:597]
  alf      = Nightshade ALF-PgmAVR, http://nightshade.homeip.net/ [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:581]
  bascom   = Bascom SAMPLE programming cable [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:571]
  dt006    = Dontronics DT006               [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:561]
  pony-stk200 = Pony Prog STK200               [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:549]
  stk200   = STK200                         [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:533]
  bsd      = Brian Dean's Programmer, http://www.bsdhome.com/avrdude/ [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:522]
  pavr     = Jason Kyle's pAVR Serial Programmer [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:514]
  dragon_dw = Atmel AVR Dragon in debugWire mode [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:507]
  dragon_hvsp = Atmel AVR Dragon in HVSP mode  [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:499]
  dragon_pp = Atmel AVR Dragon in PP mode    [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:491]
  dragon_isp = Atmel AVR Dragon in ISP mode   [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:483]
  dragon_jtag = Atmel AVR Dragon in JTAG mode  [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:475]
  jtag2dw  = Atmel JTAG ICE mkII in debugWire mode [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:467]
  jtag2isp = Atmel JTAG ICE mkII in ISP mode [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:459]
  jtag2    = Atmel JTAG ICE mkII            [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:451]
  jtag2fast = Atmel JTAG ICE mkII            [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:443]
  jtag2slow = Atmel JTAG ICE mkII            [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:435]
  jtagmkII = Atmel JTAG ICE mkII            [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:427]
  jtag1slow = Atmel JTAG ICE (mkI)           [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:420]
  jtag1    = Atmel JTAG ICE (mkI)           [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:412]
  jtagmkI  = Atmel JTAG ICE (mkI)           [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:404]
  avr911   = Atmel AppNote AVR911 AVROSP    [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:398]
  avr109   = Atmel AppNote AVR109 Boot Loader [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:392]
  butterfly = Atmel Butterfly Development Board [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:386]
  usbtiny  = USBtiny simple USB programmer  [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:380]
  usbasp   = USBasp, http://www.fischl.de/usbasp/ [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:374]
  avr910   = Atmel Low Cost Serial Programmer [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:368]
  stk500hvsp = Atmel STK500 V2 in high-voltage serial programming mode [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:362]
  stk500pp = Atmel STK500 V2 in parallel programming mode [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:356]
  stk500v2 = Atmel STK500 Version 2.x firmware [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:350]
  stk500v1 = Atmel STK500 Version 1.x firmware [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:344]
  stk500   = Atmel STK500                   [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:338]
  avrisp2  = Atmel AVR ISP mkII             [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:328]
  avrispmkII = Atmel AVR ISP mkII             [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:322]
  avrispv2 = Atmel AVR ISP V2               [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:316]
  avrisp   = Atmel AVR ISP                  [C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf:310]

Ahhh, pois...

Esqueci-me desse pormenor... bem então toda de abrir a biblioteca e passa-la para a ultima versão do Arduino... De onde tiraste a biblioteca?

Instalei a ultima versao do IDE de novo e fiz as alteraçoes ao Wire.h como disse o luisilva, e parece que ate ai tudo bem, compilo e agora dá me o seguinte erro:

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "Arduino Uno"
In file included from sketch_feb03a.ino:37:
C:\Program Files\Arduino\hardware\arduino\cores\arduino/Arduino.h:222: error: default argument given for parameter 3 of 'long unsigned int pulseIn(uint8_t, uint8_t, long unsigned int)'
C:\Program Files\Arduino\hardware\arduino\cores\arduino/Arduino.h:131: error: after previous specification in 'long unsigned int pulseIn(uint8_t, uint8_t, long unsigned int)'
C:\Program Files\Arduino\hardware\arduino\cores\arduino/Arduino.h:224: error: default argument given for parameter 3 of 'void tone(uint8_t, unsigned int, long unsigned int)'
C:\Program Files\Arduino\hardware\arduino\cores\arduino/WProgram.h:22: error: after previous specification in 'void tone(uint8_t, unsigned int, long unsigned int)'

Fiz algumas alterações no ficheiro do sketch (ao qual alterei o nome para “typhoon.ino”) e no ficheiro da biblioteca “EEPROMVar.h” e consigo compilar o sketch sem erros. Não sei se funcionará correctamente, pois não tenho o hardware para que isto funcione. Os ficheiros alterados são os que se encontram anexados.

typhoon.ino (19.8 KB)

EEPROMVar.h (2.06 KB)

luisilva: Fiz algumas alterações no ficheiro do sketch (ao qual alterei o nome para "typhoon.ino") e no ficheiro da biblioteca "EEPROMVar.h" e consigo compilar o sketch sem erros. Não sei se funcionará correctamente, pois não tenho o hardware para que isto funcione. Os ficheiros alterados são os que se encontram anexados.

Obrigado Luis, aparentemente ainda falta alguma coisa

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "Arduino Uno"
In file included from C:\Program Files\Arduino\libraries\EEPROMVar/EEPROMVar.h:3,
                 from sketch_feb08b.ino:28:
C:\Program Files\Arduino\hardware\arduino\cores\arduino/Arduino.h:222: error: default argument given for parameter 3 of 'long unsigned int pulseIn(uint8_t, uint8_t, long unsigned int)'
C:\Program Files\Arduino\hardware\arduino\cores\arduino/Arduino.h:131: error: after previous specification in 'long unsigned int pulseIn(uint8_t, uint8_t, long unsigned int)'
C:\Program Files\Arduino\hardware\arduino\cores\arduino/Arduino.h:224: error: default argument given for parameter 3 of 'void tone(uint8_t, unsigned int, long unsigned int)'
C:\Program Files\Arduino\hardware\arduino\cores\arduino/WProgram.h:22: error: after previous specification in 'void tone(uint8_t, unsigned int, long unsigned int)'
sketch_feb08b:53: error: 'BUTTON_PULLDOWN' was not declared in this scope
sketch_feb08b:54: error: 'BUTTON_PULLDOWN' was not declared in this scope
sketch_feb08b:55: error: 'BUTTON_PULLDOWN' was not declared in this scope
sketch_feb08b:56: error: 'BUTTON_PULLDOWN' was not declared in this scope