Show Posts
Pages: [1] 2 3
1  Forum 2005-2010 (read only) / Syntax & Programs / Re: Can't find a good way to get Arduino's printings on: August 25, 2010, 02:41:15 pm
Okay. So I think it's solved...

Thank you very much PaulS!

Now I'm gonna begin to code the hard part smiley-grin.
2  Forum 2005-2010 (read only) / Syntax & Programs / Re: Can't find a good way to get Arduino's printings on: August 25, 2010, 02:01:12 pm
Quote
You might read to the end of the data, and then try to read again, and by now more data has appeared on the port, so the read will succeed, whereas when you encounter an end-of-file on a file, no subsequent reads will ever succeed.
I see... this is pretty much what I am doing, however, I don't know if the constant readings(/accessing) can cause some kind of undesired behaviour... like overheating of the USB controller, asynchronism (because the port may "slow down" I think), or something like this.

I don't know if this is a "stable" solution and it doesn't look any reliable imho. I'm not an expert also, so i'll not be surprised if I'm wrong.

Is there a kind of "test" that I can make to know if it's stable (like letting the entire system working for a lot of time (24hs?)) ?

Thank you.
3  Forum 2005-2010 (read only) / Syntax & Programs / Re: Can't find a good way to get Arduino's printings on: August 25, 2010, 12:54:33 pm
Quote
Is that a problem? Why?
Isn't it? I'm not very experienced, but I think it isn't okay to read from a port like if it were a file... at least I think programs like dd, trail, or cat doesn't do this.

However, if it's okay to read a port as a file (using indata), then it's solved. I doubt this method is "solid" though.

Thank you.
4  Forum 2005-2010 (read only) / Syntax & Programs / Re: Can't find a good way to get Arduino's printings on: August 25, 2010, 08:53:39 am
Quote
Why not? What did you try?
The ways that actually works are using dd which I don't want to use, and reading the port like a file in C++ using (e.g.) indata (from ifstream), the last works very well, but It's not standard.

So I don't know any other way to do this.

Quote
Songs? Or notes?

What program on the PC? What operating system?

Notes (sorry my english) i'm going to write my own program using something like OpenAL... it's not the point right now though.

Unix-like, POSIX compatible (e.g. GNU/Linux, BSD, Solaris, Msc OS, etc.)

Thank you.
5  Forum 2005-2010 (read only) / Syntax & Programs / Can't find a good way to get Arduino's printings on: August 25, 2010, 07:43:16 am
Hello there.

I'm making a musical keyboard, and the hardware part is almost done (in scale), the keyboard basically prints on serial the keys states as fast as Arduino can. However, I couldn't figure out a good way to "read" these states into variables in a C++ program.

I've tried to use the arduino-serial program from todbot.com, but it returns garbage data, also, I tried to use tail (popen), but it's too slow and cat (popen) can't get small pieces of data.

An alternative is to use something like dd and limit the number of bytes, however, despite it should work, i don't know if it's an neat way to do this, because dd isn't intended to do this kind of reading.

The program on PC will actually play the songs for every key, so I really need a good reading rate. I don't want to waste any data from Arduino, and I think it's very possible because the PC is much faster than it.

Thank you.
6  Forum 2005-2010 (read only) / Syntax & Programs / Re: Can't read Arduino printings in C/C++ (Linux) on: August 24, 2010, 08:46:55 am
Yes man! It's working! I didn't know it was necessary to hold the reset.

Now... is it okay to keep calling "tail" to get the data?

Thank you very much Dave!  smiley
7  Forum 2005-2010 (read only) / Syntax & Programs / Can't read Arduino printings in C/C++ (Linux) on: August 24, 2010, 07:33:17 am
Hello there.

Arduino is printing some data on serial, and I just want to "read" it in C/C++. However, I've tried pretty much everything, and can't get it working.

Screen is able to listen the port just as Arduino's IDE Serial Monitor does.

However, even after configuring the port using the stty command as described here the tail command couldn't listen it.

LibSerial doesn't work also; and this program returns garbage data.

I don't know any other way to do this, and I also tried the entire tutorial from combustory.com. Tail returns nothing at all.

I'll be very grateful if anyone can help me. I just want to "read" the values into a C/C++ (doesn't matter which) program.

Thank you very much.
8  Forum 2005-2010 (read only) / Troubleshooting / Re: 74HC165 - Getting 00000000 or 11111111 on: August 20, 2010, 02:44:49 pm
Nevermind. Sorry.

The problem was this IC need the clockEnable pin to wor properly.

Thanks
9  Forum 2005-2010 (read only) / Troubleshooting / 74HC165 - Getting 00000000 or 11111111 on: August 20, 2010, 02:07:52 pm
Hello there.

I've got a 75HC165, and for some reason that i couldn't figure out, it will not return the data as expected. No matter what pin is connected, it always returns 00000000, unless the last pin is connected, then, even if only 1 pin is connected, it returns 11111111.

Thanks in advance.
10  Forum 2005-2010 (read only) / Interfacing / Re: DaisyChained 74HC165, only gettin data from 2 last on: August 24, 2010, 06:25:15 am
Yahoow! smiley-grin

After exhaustive testing, I figured out the problem! It was a defective register! I just replaced the defective one and now the fastest press is being read more than 200 times! Man! This is blazingly fast! A "normal" press is being read more than 1000 times while it wasn't even being detected with the defective register on chain.

I don't have the numbers, but it's VERY acceptable now!  smiley-grin smiley-grin smiley-grin

Thanks guys!

EDIT:
Maybe this brand of register isn't very reliable... It's from ST...
11  Forum 2005-2010 (read only) / Interfacing / Re: DaisyChained 74HC165, only gettin data from 2 last on: August 23, 2010, 11:03:09 am
Quote
Could you show us the code? Shifting-in 200+ bits should indeed not take more than 15us*200 = 3ms!

Code:
int pin_pload = 13;
int pin_clock = 12;
int pin_dados = 11;

byte bit_x;

int thread = 0;
int d = 0;

long array_x[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

void setup() {

  Serial.begin(9600);

  pinMode(pin_pload, OUTPUT);
  pinMode(pin_clock, OUTPUT);
  pinMode(pin_dados, INPUT);
}

void loop() {

  while (thread < 2500){
    pegar_registradores();
    thread++;
  }

  if(d==33){
    d=0;  
  }
  manda_dados(d++);
  thread=0;
}

void manda_dados(int dd){
      Serial.print(array_x[dd]);
      Serial.print(", ");
      
      if(dd==32){
        d=0;  
        Serial.println();
      }
}

void pegar_registradores(){
    pulsar_pin(pin_pload);

    for (int n=0; n<32; n++){

     bit_x = digitalRead(pin_dados);
 
        if(bit_x == 1)
            array_x[n] = array_x[n] + 1;

     pulsar_pin(pin_clock);
    }

}

void pulsar_pin(int pino){
 digitalWrite(pino,LOW);  
 digitalWrite(pino,HIGH);
}

This is the current code that I am using to see if it doesn't 'register' a quick press. Of course later i'm gonna use 115200 baud.

It prints one array element every 2500 cycles to keep tracking the swiches states as much as possible.

Is it possible that this is happenin because i'm using analog pins in digital mode? Or because i discarded that "ClockEnable" pin? Or maybe a register is defective?

Thanks.
12  Forum 2005-2010 (read only) / Interfacing / Re: DaisyChained 74HC165, only gettin data from 2 last on: August 23, 2010, 08:09:19 am
Quote
Huh?  What does "i don't know if massive printing is heavy" mean here?  I have no clue what you are talking about.  Take a deep breath and describe what you are trying to do. If you start at the beginning, maybe we can follow along.

It's because the program is summing the bits and sending (printing) to the serial with no delay. I don't want to bore you with coding, etc. I just want to be sure that it's possible to get good reading speed.

Quote
That is probably an issue with your software. So far, you have shown us no software and no hardware diagrams, so we're pretty much shooting in the dark here. Hope its fun for you.

I hope it's a software problem.

Quote
There was a thread about almost this exact problem (218 inputs) the other day.

Yes. On this thread AWOL said:
Quote
digital loop 2856
that the full reading loop would take 2856us. This is 0.003 seconds, so, we could say that the keys detection would run at 333Hz, what is very acceptable. However, the practical tests that i ran with only 32 inputs were much slower than this.

If it's a software problem, I'm gonna figure out for myself .I just want to be sure that it's possible to "achieve" 333Hz of "reading rate" for my 218-key Musical Keyboard. smiley

Thanks guys.
13  Forum 2005-2010 (read only) / Interfacing / Re: DaisyChained 74HC165, only gettin data from 2 last on: August 21, 2010, 03:53:25 pm
Thanks guys.

I just figured out that by printing bit-by-bit it's possible to get the entire data  :-[.

So it's a software problem. Another thing that i figured out is that you can simply connect that silly ClockEnable Pin to the ground.

The problem probably is that I don't understand the bitwise operations very well. I wanted to send a long binary string to the computer, but it's hard to do this using my very limited knowledge, so i am sending an array.

Now i have another problem... i plan to connect more than 200 inputs using daisychained 74HC165's, however, i don't know if massive printing is heavy, but it can't detect quicker presses... i knew it was going to be slow, but the guys on the other thread said it was going to be alright to make a musical keyboard (>3us of rate) however, even with 32 inputs the thing is very slow smiley-sad.

Thank you.
14  Forum 2005-2010 (read only) / Interfacing / DaisyChained 74HC165, only gettin data from 2 last on: August 21, 2010, 01:23:06 pm
Hello there.

I've successfully daisy-chaned 2 of these ICs together, i'm using this example to get the data from them.
Everything was working very well, then I added 2 more ICs on the chain, however, now i can't get the data from the first two... i didn't forgot to change the int into long, and if i setup 3 of them, i can't get data from the first. So only the last 2 are actually working.

The setup is very basic, as i'm trying to assemble a musical keyboard, i simply linked every Clock, Clock Enable and Parallel Load pin together, connected to the respective arduino pin, and the Q7 from the last IC on the chain to arduino, and chained the Q7 to the DS of the next IC. I can make a schematic if it's hard to understand.

I'm totally noob and couldn't figure out what's wrong.

Thanks in advance.
15  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Software used to produce this (see topic) picture. on: August 20, 2010, 08:23:28 am
Hmmm... Looks like the image was produced using a vector drawing program.

Fritzing is good, however, it runs terribly slow (at least on my machine (C2D E6750, 4GBDDR2@1066(dual)) after wiring a single breadboard, every click takes something like 1sec.

After solving the performance issue, I have a very helpful and cool idea that could be implemented. The idea is to colour the breadboard holes according to the wires colours, like this:

Uploaded with ImageShack.us

Nice, huh?

Another feature is the ability to render curved wires.

It would be nice also to be able to see an entire circuit by highlighting it or something, and also to activate the switches to interrupt it.

Quote
It is. Where did you get the picture? That might provide a clue. I don't recognize it. I've never seen another picture like it.
Quote
It's from the ShiftOut tutorial page.
and the ShiftIn tutorial has a similar image.

Quote
Just realize that while it helps you, eventually the training wheels need to come off...
Sure! However... isn't "Arduino" itself a kind of "training wheels"?

Quote
my 1024 led matrix
Oh my God! This is amazeing!!

Quote
This discussions pretty much answers my topic smiley... I would like to hear from the author of those pics though.

Thank you very much guys! [smiley=thumbup.gif]
Pages: [1] 2 3