Pages: [1]   Go Down
Author Topic: strange error  (Read 383 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

when i hit verify on the ide i get a strange error with one particular program. i have seen this error elsewhere on the boards but the fixes suggested havnt worked for me. here is the error:

C:\Users\Owner\AppData\Local\Temp\build6619.tmp\core.a(wiring_serial.c.o): In function `__vector_18':


C:\Users\Owner\Desktop\arduino-0015\hardware\cores\arduino/wiring_serial.c:112: multiple definition of `__vector_18'


C:\Users\Owner\AppData\Local\Temp\build6619.tmp\core.a(HardwareSerial.cpp.o):C:\Users\Owner\Desktop\arduino-0015\hardware\cores\arduino/HardwareSerial.cpp:95: first defined here


Couldn't determine program size: C:\Users\Owner\Desktop\arduino-0015\hardware/tools/avr/bin/avr-size: 'C:\Users\Owner\AppData\Local\Temp\build6619.tmp\sketch_090519c.hex': No such file


a few people were saying in other threads that it could likely be an error in the program stopping the program from compiling and therefore causing the unknown size error at the bottom, but i dont think this is the cause. ill include the code anyway

Code:
int pin1 = 2;
int serialIn;

void setup ()
{
  Serial.begin(9600);
  pinMode(pin1,OUTPUT);
}

void loop ()
{
  serialIn = serialRead();
  if (serialIn = 49)
  {
    digitalWrite (pin1,HIGH);
  }
}


I am running Windows Vista Intel Core 2 duo 1.66 GHz. any help would be greatly appreciated

EDIT: problem solved, it was a syntax error (shame on me). Thanks for the quick replies and help
« Last Edit: May 19, 2009, 07:59:55 am by MrAndrews » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 178
Posts: 12288
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What files are in the Sketch directory?

- Brian
Logged

Wuppertal/Germany
Offline Offline
God Member
*****
Karma: 1
Posts: 895
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi MrAndrews,

Inside the loop function your are calling
Code:
 serialIn = serialRead();
but function serialRead happens to be the name of an internal function of the basic Arduino-source files. This function was not intened to  be called from Sketches like yours, but there is also no way to prevent  it to happen by accident :-(

But this is just a short explanation why the error is reported. The solution is simple :

Use the function Serial.read()
Code:
 serialIn = Serial.read();
Yes, the same characters  but in different case and a dot in the middle, a bit confusing when you just started with programming. But this really is a totally different function, and the one you should use in your sketches.
http://arduino.cc/en/Serial/Read

Eberhard
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i think you mean to do
Code:
if(serialIn == 49)
instead of
Code:
if(serialIn = 49)
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Wayoda, thanks so much for the help. i was actually meaning to use the built in function Serial.read but didnt realize my mistake when i was debugging. iv fixed the error and it works fine now
Logged

Pages: [1]   Go Up
Jump to: