Show Posts
Pages: 1 [2] 3 4 ... 9
16  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino 007 on: January 07, 2007, 12:04:58 pm
I had problems booting the arduino ide too, but it wasn't a java problem..(at the beginning I thought it was)
it was due to a high assigned port number to the USB-COMport (it was on port20)
and it seemed that the arduino hanged while scanning for all ports.

if you have this problem, just change it to a lower port and it will load

17  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino crashes with Serial bug?! on: January 06, 2007, 07:04:35 pm
thanks cosinekitty...
I was already using
while (Serial.available())
without even checking for a value

now that thing is misteriously working...as the bug before it magically solved without my intervention...

I had very weird behaviours on this board:
I tried one simple script-that worked in printing a simple serial feedback ("hello world",
 then only resetting the board...not changing or uploading the board, the script would bug!!!   :o
It was simple impredictable! some times it worked, some other it didn't

that got me nuts.. I tried every combination of actions...
it got to the cabalistical level that I thought it was my wool pool causing some electrostatic interference...so I took it out...
guess what...
it started working again!!!!!   :o  :o

can that be possible? or am I just placebo-ing it??

I'm not totally sure that this thing is solved, but for now it's working again, and hasn't bugged for a couple of hours so far...
I think this thing is testing my faith: if I believe, it will work. smiley

I'm down to timing issues now smiley
though I can't tell if tomorrow my code will autofix...
I'll give it a night of prayers and see what happens tomorrow.
else you will hear me again on the troubleshooting forum smiley

may the arduino be with you
b.
18  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino crashes with Serial bug?! on: January 06, 2007, 10:22:34 am
# set the serial port defaults
serial.databits=8
serial.stopbits=1
serial.parity=N
serial.port=COM1
serial.download_rate=19200

serial.debug_rate=9600
serial.burn_rate=115200

should I change the debu_rate???

in any case with or without changing this...Arduino decided to start working again!!!!?!?!?!
I can't explain why...I went to lunch and when I got back it all worked again.
- Terminal software could recognize comport9 and succesfully connect to it.
- Arduino could safely load and read with its serial monitor...
WEIRD WEIRD!  maybe its time for a format c: smiley

I've got another problem now... it concerns Serial handling...
it seems as I've got a data-type problem or the Serial lib is giving a data-type problem:
reading and storing a char from serial (Serial.read()) only becomes really a char (casts to) after being PRINTED BACK to SERIAL via Serial.print()

let me explain
this:
Code:
unsigned char My_string [5];
My_string[0] = Serial.read(); //should store a char '1' or '0' sent from any terminal

//if you try to check it - it won't work
//won't print - as it doesn't recognize it as a char ' '
//if (My_string[0] == '1') {  Serial.print( "I read Char: 1"); }

//wont work - as by using the double " " we are comparing to a string datatype and the compiler outputs:
//error: ISO C++ forbids comparison between pointer and integer
//if (My_string[0] == "1") {  Serial.print( "I read Char: 1"); }

//ONLY IF YOU FIRST PRINT IT BACK TO THE SERIAL BUFFER IT WILL BECOME READABLE AS A CHAR
Serial.print( My_string[0]);
if (My_string[0] == '1') {  
       Serial.print( "I read Char: 1"); //OK it prints out
}

I've tried all sorts of casting
byte my_char = My_string[0];
int my_char = My_string[0];
unsigned char my_char = My_string[0];
but none will work untill I printed back to Serial.

I've checked the new HardwareSerial lib and it seems only as a wrapper for old serial function.
everything leads back to wiring.c > void serialWrite(unsigned char c)
but it doesn't seem to be casting the datatype to anything...it should be a char but it doesn't print as a char...

any idea?
is it a pointers problem??? (tryed some * & combination but non really produced any good)

thanks in advance
b.
19  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino crashes with Serial bug?! on: January 06, 2007, 08:12:22 am
hey d.

unfortunately I don't have here another pc to try it with. but I have some new reports on the problem

after rebooting the pc this morning arduino seemed to work again, and could perfectly upload sketches on the board.
after a couple of trials I got the same error.
so I checked again if it was possible to connect with other terminal softwares.

terminal.exe (the standard terminal that is suggested with the arduino distro) can't strangely connect to COM9. it doesn't allow me to select it.

hyperterminal, after a couple of trials, managed to work, but is kind of difficult to use and I'm not totatlly sure if it did actually work fine...i got the serial feedback from my board.

right after hyperterminal worked I went to the arduino terminal software and it reported this NEW bug:

Error inside Serial.<init>()
gnu.io.UnsupportedCommOperationException: Invalid Parameter
      at gnu.io.RXTXPort.setSerialPortParams(RXTXPort.java:171)
      at processing.app.Serial.<init>(Serial.java:130)
      at processing.app.Serial.<init>(Serial.java:63)
      at processing.app.Editor.handleSerial(Editor.java:1421)
      at processing.app.EditorButtons.mousePressed(EditorButtons.java:373)
      at java.awt.Component.processMouseEvent(Unknown Source)
      at java.awt.Component.processEvent(Unknown Source)
      at java.awt.Container.processEvent(Unknown Source)
      at java.awt.Component.dispatchEventImpl(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Window.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.EventQueue.dispatchEvent(Unknown Source)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.run(Unknown Source)

the new Serial library is kinda buggy!

I checked on myPc > properties > hardware manager > compPorts
for the right options of the arduino port.
- There is an option where you can change the number of the port, but oddly enough I couldn't put it lower than port 9 since it stated me that all other where in use...but looking at the hardware manager list I couldn't find it.
- there is another option in which you set the speed of the comport, i've set it to 19200 as it was the speed of my sketch.


I will try to uninstall and reinstall the FTDI drivers...to see if it's an issue with them.
does this new bug suggest you anything???
Error inside Serial.<init>()
gnu.io.UnsupportedCommOperationException: Invalid Parameter

thanks in advance
b.
20  Forum 2005-2010 (read only) / Troubleshooting / Arduino crashes with Serial bug?! on: January 04, 2007, 07:03:42 pm
Hi everybody,
after several months of self mutilation for not coming back to the arduino forums...I'm back
with bugs  ;D

coulnd't solve this one.

I get a weird serial behaviour.

at the beginning, when starting the serial monitor, I kept getting this warning in the middle of nonsensical chars

Error inside Serial.serialEvent()
java.io.IOException: No error in readByte
      at gnu.io.RXTXPort.readByte(Native Method)
      at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250)
      at processing.app.Serial.serialEvent(Serial.java:214)
      at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732)
      at gnu.io.RXTXPort.eventLoop(Native Method)
      at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575)
      

after that I couldn't even upload the sketch. and got this warning...
BUT the port wasn't in use....no one was using it.

Error inside Serial.<init>()
gnu.io.PortInUseException: Unknown Application
      at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354)
      at processing.app.Serial.<init>(Serial.java:127)
      at processing.app.Serial.<init>(Serial.java:63)
      at processing.app.Editor.handleSerial(Editor.java:1421)
      at processing.app.EditorButtons.mousePressed(EditorButtons.java:373)
      at java.awt.Component.processMouseEvent(Unknown Source)
      at java.awt.Component.processEvent(Unknown Source)
      at java.awt.Container.processEvent(Unknown Source)
      at java.awt.Component.dispatchEventImpl(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Window.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.EventQueue.dispatchEvent(Unknown Source)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.run(Unknown Source)


I checked everything:
- Serial.begin(19200) was set to the corresponding speed in the serial monitor - not the problem
- I checked for other programs using the comport but non that i knew where doing so.
- i tryed starting and stopping the serial monitor
- I tryed closing and restarting arduino
- I tryed closing and restarting windows (xp)
- I tryed uploading another simple sketch (led blink) and once i succeded, tryed the second time and got the same error...

did I brake arduino???
any idea?

cheers
oh ... and merry jingle bells to all the forum and a happy new year smiley
b.
21  Forum 2005-2010 (read only) / Troubleshooting / Re: 4 bit LCD on: May 04, 2006, 02:03:04 am
voilĂ !
you have been deleted!
you and all others can subscribe at the following page
http://www.arduino.cc/playground/Main/LoginForm

there are many contributors but very little content...this thing needs to get working smiley

cheers
b.
22  Forum 2005-2010 (read only) / Troubleshooting / Re: 4 bit LCD on: May 03, 2006, 11:58:39 am
hey tomek,
sounds great! why don't you post it into the www.arduino.cc/playground wiki??
that could help everybody!

thanks in advance
b.
23  Forum 2005-2010 (read only) / Troubleshooting / Re: Send more than a byte on USB on: April 02, 2006, 06:41:25 am
ok, I'll try to explain you the concept part..if you then tell me more precisely what you really need I can help in the details of twisting this function to your own needs.

1st - declaration of the array
Code:
char serInString[100];  // array that will hold the different bytes of the string. 100=100characters;
                     // -> you must state how long the array will be else it won't work properly
this is important to store long information coming from the serial buffer all in one variable.
if you know the length of your string you can change the number 100 with watever suits you best:
you said that you need 2 bytes = 2x8bit = 16 bits + the endofline or a separator chars
just put that number instead of 100
BEWARE of the type declaration, here the array is declared as a "char", but you can make it an int if you want just numbers to be stored in the array

2nd - the read string function
Code:
//read a string from the serial and store it in an array
//you must supply the array variable
void readSerialString (char *strArray) {
    int i = 0;                         // the progressive array index so that every bit is stored in another index of the array
    if(serialAvailable()) {             // this allows to execute the function only if there really is data in the serial buffer
       while (serialAvailable()){       // we've cheched that there is data in the buffer...just loop through it untill there are bits in it
          strArray[i] = serialRead();       // store in the array declared at the beginning at the specified index the first available bit of the serial buffer... when you read it the value will be automatically removed from the serial buffer
          i++;                   //increment the index counter so that the next value will be stored in the next array index
       }                         //return to the while loop
        strArray[i] = 13             //optional: now the while loop is finished, hence there is no more data in the serial buffer. you can now eventually add by hand some bits to your array. this is how you create your own protocol. store a carriage return or end of line or whatever else.
    }      
}
this is a stripped down version of example number 4 but you can also refer to the previous examples, maybe example 1, for the most simple integration of the same concept in the loop function


3rd - usage in the loop function
Code:
//read the serial port and create a string out of what you read
  readSerialString(serInString);
- just put into your loop in the moment when you know that there might be info in your serial buffer
- pass it the name of the array declared at the beginning
and the trick is done!
right after that line your "serInString" will be loaded with all the needed data... (only if there actually was data in the serial buffer)

hope this helps..
if you tell us exactly what your string should look like I might be able to help in reusing the function for your pourposes.
b.
24  Forum 2005-2010 (read only) / Troubleshooting / Re: Send more than a byte on USB on: April 01, 2006, 04:54:32 am
hey sorry for asking
but did you check my examples????
http://www.progetto25zero1.com/b/tools/Arduino

in the serialCom_handeling_multiple_bytes_04 you can find 2 reusable functions
printSerialString() and readSerialString()
that to me seem to be exactly what you are looking for.

you can then change the code to insert special chars at the end or in between strings to make your own protocol.

if you can't understand the code there I could explain it a bit better..
just tell me

cheers
b.

25  Forum 2005-2010 (read only) / Troubleshooting / Re: Send more than a byte on USB on: March 16, 2006, 06:08:38 am
I'm not sure if you really need this,
but If you need to send strings
here you have some code I wrote for Arduino
http://www.progetto25zero1.com/b/tools/Arduino

the serialCom_handeling_multiple_bytes example should also be among the examples available with Arduino0003

b.
26  Forum 2005-2010 (read only) / Troubleshooting / Re: Need help with code on: February 20, 2006, 12:54:52 pm
hey

you could also use the logical operator AND &&
to check in the same if statement that the value is inside the desired range... like so:

Code:

//assuming 3 values 150, 160, 170)

if (val < 150) {
         ligthUpLed(0); // Light up the first LED in the array

//this is the range check...this just says :
//if the value is between 150 and 160 (greater than 150 AND at the same time smaller than 160)
//turn on the first led
} else if ((val > 150) && (val<160)) {
         ligthUpLed(1);

//keep going on with all the ranges you want
} else if ((val > 160) && (val<170)) {
         ligthUpLed(2);
}
//etc etc. - repeat for all desired ranges


this sums up to a much tidier and clearer code.

just to know...what sensor are you using?

there is something that can interest you:
yesterday on makezine.com there was a link to a termometer project...might have some C code for you
or other reference
http://www.makezine.com/blog/archive/2006/02/how_to_measure_temperature_wit.html


hope this helps smiley
b.


27  Forum 2005-2010 (read only) / Troubleshooting / Re: working with strings, cut in parts on: December 15, 2005, 10:08:20 am
cool  smiley !

hopefully today I'll also post the Arduino Actionscript 2.0 class for flash.

ciao
b.
28  Forum 2005-2010 (read only) / Troubleshooting / Re: working with strings, cut in parts on: December 13, 2005, 04:51:31 pm
ok try here,

http://www.progetto25zero1.com/b/tools/Arduino/

these are the examples I've set up to work with long strings.

what you probably should do after reading it,
and hence storing it into a String-Array,
is loop trhough that array and at every index associate your action to your relative pin.
for that you could use another array in which you store the pin numbers at the same index as your StringArray

check it out.


hey david, please tell me what you think of the code smiley
I've never written anything in C and so this got my head quite a lot before understanding the right syntax. I'm a designer not a computer scientist smiley

ciao
b.
29  Forum 2005-2010 (read only) / Troubleshooting / Re: working with strings, cut in parts on: December 12, 2005, 10:37:03 am
that's a good question,
I've been gibbling around with this for a week
and I'm going to post a tutorial soon (hopefully tonight)
it's all about handeling multiple bytes in Arduino.

but ofcourse if any other advanced user has some tips for us newbies that would be just great! smiley

in general the C language (and Arduino as far as I know) can't handle strings natively.
in C you can import a string library but you need to do some workarounds in Arduino to set it up.
the basic concept is that a string is an array of single bytes or chars. In the samples I'm preparing there should be reusable functions for this kind of problems. and an Actionscript Class to easily set up a communication between Flash and Arduino.

I'll get back here to give you the url and to let the Arduino masters tell me If I got the right or wrong method. smiley-wink

l8r
b.

30  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: add ability to write to EEPROM on: May 27, 2006, 06:33:22 pm
I post it here just for completenedd
I've found the reference page in the AVR-libc manuals
http://www.sigterm.de/projects/sens-o-nuts/Dokumentation/atmel/libc/group__avr__eeprom.html

I can say that your code is way more clear smiley
but hey...it's just a reference

cheers
b.
Pages: 1 [2] 3 4 ... 9