Author Topic: Arduino Code Request - Byte Stream to Array  (Read 16657 times)

0 Members and 1 Guest are viewing this topic.

Offline Chet T16Topic starter

  • Frequent Contributor
  • **
  • Posts: 535
  • Country: ie
    • Retro-Renault
Re: Arduino Code Request - Byte Stream to Array
« Reply #25 on: September 22, 2011, 10:33:33 am »
Looks good  :)
That state machine should allow you to read in the data and do whatever you want with it.

Thanks for the help (everyone!)

I've added in a loop to print the array to a software serial port so i'll give it a test and see what happens
Chet
Paid Electron Wrestler
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11630
  • Country: my
  • reassessing directives...
Re: Arduino Code Request - Byte Stream to Array
« Reply #26 on: September 22, 2011, 10:56:26 am »
MyData[Counter-4] = ReadByte;
Counter++;
ops, you are right, i should imaginate and have the picture flowing in my mind :P but still your previous code is not 100% right, so maybe we all got some mistake. thats why i used to extend the possibility, such as...
Code: [Select]
if ((Counter - 4) <= 38) {
MyData[Counter - 4] = ReadByte;
Counter++;

if ((Counter - 4) >= 38) {
DisplayAndOrClearData(); // another function
Counter = 0;
}
}
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline Chet T16Topic starter

  • Frequent Contributor
  • **
  • Posts: 535
  • Country: ie
    • Retro-Renault
Re: Arduino Code Request - Byte Stream to Array
« Reply #27 on: September 22, 2011, 04:47:53 pm »
Dammit, a hardware issue somewhere

To read the data i need to invert the signal from the ECU which i use this circuit for



I use this with an FTDI cable to read the stream directly and its fine. When there is data coming the LED flashes but when i connect Rx to the arduino rx pin the LED goes out. I just checked at theres 5v at the arduino rx and tx pins. Whats that all about??
Chet
Paid Electron Wrestler
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf