Show Posts
Pages: [1] 2 3 ... 38
1  Forum 2005-2010 (read only) / Troubleshooting / Re: Serial problem on: December 10, 2008, 07:52:10 pm
Since you said you have tried switch tx/rx, and changing baud, it sounds like the most likely culprit is that you have made a mistake in your code somewhere - perhaps you forgot somewhere to change the AFSoftSerial() command to a normal serial() command...

Ofcourse without posting your code, only you can tell...
2  Forum 2005-2010 (read only) / Troubleshooting / Re: The Dreaded upload error of DOOM! on: December 10, 2008, 07:54:30 pm
Have you got a programmer? If so, just re-burn the bootloader and I'll bet you'll be fine. You could also use some of the "self program" techniques described on the forum if you don't have one.
3  Forum 2005-2010 (read only) / Troubleshooting / Re: Problems with Arduino on: November 11, 2008, 09:57:11 pm
Simple solution!

You've chosen the wrong board in the menu. you need to choose "Arduino NG or older with AtMega8"

By choosing "Decimilia" it assumes auto-reset and AtMega168
4  Forum 2005-2010 (read only) / Troubleshooting / Re: Test sketch not uploading on different compute on: April 16, 2008, 10:59:08 pm
It's most likely the timing of the reset.

Depending on the speed of your computer, you have to push the reset button on the arduino at different times.

On my old PII 300MHz laptop, I have to push the reset button about 3 seconds AFTER I push the upload button in the IDE.

On my 2400MHz desktop, I push the reset and upload buttons simultaneously.

When you push the reset button, the bootloader waits (depending on which version of the bootloader you are running) 3 seconds for a new sketch to be uploaded. If it doesn't get anything within those 3 seconds, it starts to run the last uploaded program which is still in it's memory.

When you push the upload button, the IDE compiles you program, and starts the upload. This process is so slow on my old laptop, it misses the 3 second "window" if I don't time my reset button push just right, and I get the "not in sync" error you are seeing.

Of course I just realised that you have a Decimila, which has the auto reset feature yeah? I always forget about that, I only have the original USB board (pre-NG even!).

It still may be a timing issue. Alternatively, triple check the right Board and serial port are selected in the "Tools" menu. I see that error when I build for an Arduino with a different clock speed, eg. lilypad.
5  Forum 2005-2010 (read only) / Troubleshooting / Re: processing forum sucks, please help! on: January 03, 2008, 07:50:45 pm
Quote
but i cant even make a succesful sketch to make an led turn on the baord, i dont know what barebones code i need to write!
and how do i tell it my port is com 3?
and what do i use instead of "digitalWrite" and instead of "pinMode"
and instead of "HIGH" and instead of "OUTPUT" becuase for all those things it sais it's not located in some temporary folder on my comp...

i'm also trying to edit your code to work with, but its not working either, are those port. commands neccasery, or do i just get rid of them?

thnks for the quick reply btw!!


OK - first of all, you know that processing and arduino are two different programs, and each has a specific and totally different purpose?

To make and Arduino board respond to processing commands, you need to write TWO DIFFERENT sketches - one in the Arduino IDE, compiled and then uploaded to the Arduino board, and another written in the Processing IDE, and then run on your PC.

To do what you are trying to do, the framework of the processing sketch will look  like what I posted.  The arduino sketch will look like a typical Arduino sketch that you are used to - it will have the digitalWrite() and pinMode() calls.

In regards to your specific question about the processing sketch, the line

Code:
println(Serial.list());      // What serial ports are avaialble?

will output the available serial ports to the black area at the bottom of the Processig IDE. You use the number corresponding to COM3 in the list in the next line. Also, the number will be the same as the position (zero indexed) COM3 appears in the TOOLS -> Serial Port list in the Arduino IDE, i.e. if it's the third on the list, you should use [2].

In general, it sounds like you are trying to jump into things too quickly, and then getting frustrated when it doesn't work. I used to do excactly the same thing, and I don't know whether it's getting older, doing more projects, or doing engineering work as a job that has made me realise that knowing what you are doing first makes the job a lot easier.

Start with reading ALL the reference sections of the Arduino website - it really is a valuable resource. Equally (or perhaps more) valuable are the example sketches, and I think you are lucky, beacuse there is an example which has both an Arduino sketch and Processing sketch which does almost exactly what you are trying to do, although rather than lighting and LED when a certain key is pressed on the computer, it lights up when the mouse rolls over an area on the screen.

You can find the example (at least on Arduino 0008 - might change for other versions, I'm not sure) in the Arduino IDE by going

FILE -> Sketchbook - > Examples -> Communication -> Physical Pixel

Note the Arduino code is at the top, the Processing code is below, and commented out. You can copy out the processing code into a new processing sketch, or you can simply open it as an example in processing by going

FILE -> Examples -> Libraries -> Serial -> SimpleWrite

See how easy they have made it for you!

So play around with the example, then do a FILE -> Save As for both, and modifiy the Processing skecth so that it sends out the key you press, and modify the Arduino sketch to listen to what it receives over the serial line, and lights up an LED according to what key it was.

Feel free to ask questions, but it makes it easier on everyone if it's obvious you've read all the help, reference and examples.
6  Forum 2005-2010 (read only) / Troubleshooting / Re: processing forum sucks, please help! on: January 03, 2008, 06:39:37 pm
OK it's not that hard. It took maybe 3 hours for me to get this stage from nothing, i.e. downloading processing, looking at the examples, trying code, writing the complimentary arduino code.

Code:
import processing.serial.*;     // Import the serial communication package
Serial port;          // This came from all the example sketches

void setup()
{
   println(Serial.list());      // What serial ports are avaialble?

    port = new Serial(this, Serial.list()[0], 9600); // 0 = RS-232, 4 = USB
  
    port.write(hour());  //Send the hours as a two digit number
      delay(100);
    port.write(minute());  //Send the minutes as a two digit number
      delay(100);
    port.write(second());   //Send the seconds as a two digit number
}
 
void draw()
{
  // I just needed to send the time once, didn't need to do anything after that so draw() is empty
}

You'll need to change a few things - you'll want to move the port.write calls to the draw() function for example.

It should have everything you need to send stuff to arduino from processing though. You can get all of this stuff from the Serial Library page http://processing.org/reference/libraries/serial/index.html and the example is on the serial.write page http://processing.org/reference/libraries/serial/Serial_write_.html

You'll probably also want to use the keyTyped() function

Code:
void keyTyped() {
  println("typed " + int(key) + " " + keyCode);
}

http://processing.org/reference/keyTyped_.html
7  Forum 2005-2010 (read only) / Troubleshooting / Re: Heart Rate Logger on: October 07, 2007, 08:13:56 pm
Quote
Ok I finally got round to putting up my bit of test code for the usb memory stick

http://www.arduino.cc/playground/Main/UsbMemory

Dude, that is seriously awesome. I would buy the module, but shipping to australia is a killer! Will have to look around for other suppliers.

Thanks for the link and the code.
8  Forum 2005-2010 (read only) / Troubleshooting / Re: Timed Serial communication on: February 26, 2007, 05:39:28 pm
Cool. I'm actually not using the USB serial port, I'm using PC Serial Port --> MAX232 --> Arduino pins 0,1,GND.    I was thinking I could connect the PC RTS pin to the Arduino interrupt pin.
9  Forum 2005-2010 (read only) / Troubleshooting / Timed Serial communication on: February 26, 2007, 05:08:28 pm
For a project I want to be able to send data from my PC to arduino at regular intervals, say every 5 minutes. It seems wasteful to have the arduino in a loop waiting for data the wholoe time, is it possible to use the RTS data line of an RS232 connection to trigger the arduino external interrupt which would then recieve the data? seems like a much more efficient way of doing it, especially for remotely powered projects.

thanks!

Alex

10  Forum 2005-2010 (read only) / Syntax & Programs / Re: FINDing within strings on: September 14, 2010, 03:24:20 am
Dude, that is awesome, thanks heaps. Worked perfectly - just added my own series of strings that I am looking for.

Still trying to learn exactly HOW it works, but it does!

Thanks again
11  Forum 2005-2010 (read only) / Syntax & Programs / FINDing within strings on: September 13, 2010, 06:04:19 am
Hey guys,

Hoping someone can help me out with finding a sequence of predefined characters within a string.

I have a string that is built from characters coming over the serial port. I want to find if a certain predefined string of characters exists within than longer string.

There is a c++ function for this - find - http://www.cppreference.com/wiki/string/find - I just can't work out how to use it properly within arduino world. I THINK it may have something to do with declaring my string using the char type (as in the arduino string reference page) - but that's just a guess at this stage.

Does anyone have any info or can point me in the right direction please?

Thanks

Alex

12  Forum 2005-2010 (read only) / Syntax & Programs / Re: Why does "for" not work on: February 16, 2010, 11:47:51 pm
You don't need to do a pinMode for the analog in pins.

By using the analogRead() command that is enough for it to know that you want to use the analog pins.

13  Forum 2005-2010 (read only) / Syntax & Programs / Re: Take action based on string on: October 25, 2009, 04:09:11 pm
Awesome!

Thanks heaps - will try to digest now...
14  Forum 2005-2010 (read only) / Syntax & Programs / Take action based on string on: October 25, 2009, 05:44:01 am
Looking for some help, but don't really know what it's called, so not sure how to search for it!

OK so I get sent a string, say "ABCFL"

For each item in the string, I want to take a unique action. For each possible string value, I've got a function that changes the state of a number of digital pins.

Is there anyway to call a function based on a character without looking through every possible value using if & ifelse statements?

Is there a way to like, put multiple commands into an array? Like could I somehow put
Code:
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
delay(100);
digitalWrite(13,LOW);
digitalWrite(12,LOW);

into an array at position 48, so that if the character in the position of the string I am looking at was "0", I could use 0 as a value to look up the sequence in the array, it would perform that sequence of lines?

Obviously I can write a function that wraps those lines up into a small function.

The only way I can think to do it is to write a big, long in-elligant function that says
Code:
if(string_value=='0'){
zero();
elseif(string_value=='A'){
a();
elseif(string_value=='B'){
b();
...


I'm obviously no programmer, and this is badly explained, so thanks for your help.

Alex



15  Forum 2005-2010 (read only) / Syntax & Programs / Re: Square or Sinewave on: October 07, 2009, 10:16:08 pm
You didn't put it in the right place (I think)

You put it in the /hardware/libraries folder yeah?

That was right for previous versions of the IDE, for 0017 read mem's post above.

It should go in the "My Documents" area, under /Arduino/libraries
Pages: [1] 2 3 ... 38