Show Posts
Pages: [1] 2 3 ... 8
1  Using Arduino / Programming Questions / Re: Emulating read serial data. on: July 18, 2012, 01:57:40 am
Thank you both for your replies — certainly no whining for me.

The serial data I posted has been converted to hex by the terminal software — the serial data returned is a load of bytes as you'd expect. So the whole lot is received in about 3.5ms?

It's a great idea to do the maths as it goes and to just pick out the values I need rather than storing it in RAM and then going through it afterwards — the cycle to go through the read data can be cut short once I've found the two values I want to display. Though I guess the reality of this is wether or not me adding the if statements slows it down. However I don't think it'll be an issue for what I want to do with it.

I've found the portion of the MS3.INI which defines the byte offset and scalar and translate values, it's roughly the same as the table I posted. I don't need or want to use most of the additional values but a few are useful none-the-less. (otherwise I would have just bought an MS2 and not a MS3, it's cheaper)

There also seems to be a different way of asking for the data if you only want a portion of it.
Code:
;full version that works anywhere - be sure to change the no. bytes requested
   ochGetCommand    = "r\x00\x07\x00\x00\x01\x98"

Thanks for all your help — I am waiting for a couple of components to finish off the hardware and then I'm good to start writing the code properly.
2  Using Arduino / Programming Questions / Re: Emulating read serial data. on: July 17, 2012, 02:55:15 pm
All I want to do is cherry pick a couple of values and fire them out to a display via SPI — so I'll only be calculating on two at most.

I was hoping to split it in to bytes so that it's exactly as it is when I read it in via the serial port. I guess I'll have to do that by hand.

I've realised now that the MS3 which I have has a much bigger output — 408 bytes exactly as you say. The first set of values are all the same though.

You got all the values right — 23 degrees outside temp and the engine was 30 degrees as it was a few hours after it had been run.

I have since found a library that will work with the MS — but it's a bit heavy for what I want to do and as with everything this is a learning thing for me. I'm also planning to use SoftwareSerial for this too. It does give me the code that combines the bytes to form the 16-bit integers so that's a plus point.
3  Using Arduino / Programming Questions / Emulating read serial data. on: July 15, 2012, 02:11:38 pm
Hi all,


I'm writing some code that will capture some serial data that is a series of variables that my cars ECU spits back— I then need to chop this up so I can access various things like temperature, RPM etc

I have captured this data using some software— and I think it looks right?

Code:
02d2 0000 0000 0000 0000 0000 9393 0101
03df 03e0 02dc 0301 8401 d378 00c7 0000
0000 03e8 03e8 03e1 0064 0000 0064 03ed
0064 0064 0064 00a0 0000 fffa 0002 0020
0000 03e0 0064 0000 0064 03fe 0000 0000
0000 00e6 0000 009c 0000 03e0 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0064 0000 03e0 03e0 0000 0000 0000 0000
0000 0000 0000 0000 0000 0003 c700 0000
0000 0000 0000 0000 0000 0000 03fe 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 03e8 03e8
03e8 03e8 03e8 03e8 03e8 03e8 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000

Here's how it's chopped up: http://home.comcast.net/~whaussmann/RS232_MS2E/RS232_RTvar.htm

What I want to do is get that data in to an array so that I can play with it— it's not practical for me to sit in the car whilst I try out the various things I want to do with it.

What's the easiest way for me to get that in to an array? By hand? The data looks like it's in pairs of hex values? I am not sure.


James

4  Using Arduino / Networking, Protocols, and Devices / Re: Serial conundrum on: July 13, 2012, 03:12:08 pm
Brilliant — thank you very much!
5  Using Arduino / Networking, Protocols, and Devices / Serial conundrum on: July 11, 2012, 04:21:35 pm
Hi all,

I have a little 4 x 7 segment display that runs off SPI — the one from Sparkfun. Works like a charm using this code that I wrote:

Code:
void outputDisplay(char* stringIn) {
  digitalWrite(slaveSelectPin,LOW);
  SPI.transfer(byte(0x76)); //reset display
  for (int i = 0; i<4; i++){
    SPI.transfer(stringIn[i]); //output char
  }
  digitalWrite(slaveSelectPin,HIGH);
}

At the moment I am trying to do something simple and get it to display anything that gets sent to the serial.

Code:
if (Serial.available() > 0) {
      // read the incoming byte:
      incomingByte = Serial.read();
      outputDisplay((char*)incomingByte);
 }

The problem is that it's not working as expect it— it seems to just send random stuff to the display.

I seem to want to convert from ASCII to a string?

Any help on this?


James
6  Using Arduino / Networking, Protocols, and Devices / Re: Arduino -> Xbee -> Xbee -> Shiftbright on: January 11, 2012, 07:42:49 pm
Thanks Paul.

I'm looking at some other wireless modules now — specifically the CS2500 which seems to have two configurable outputs - one being a clock.
7  Using Arduino / Networking, Protocols, and Devices / Re: Arduino -> Xbee -> Xbee -> Shiftbright on: January 07, 2012, 06:56:28 pm
Slight change of plan— the RGB pixels I have decided to use are these, a lot cheaper:

http://www.bliptronics.com/item.aspx?ItemID=113

It's not just serial — it's serial plus a clock — it uses the LPD6803 chipset.

I know that the Xbee can have multiple outputs but can they work together in parallel?
8  Using Arduino / Networking, Protocols, and Devices / Arduino -> Xbee -> Xbee -> Shiftbright on: January 06, 2012, 08:06:47 am
I am planning on building a wall clock that consists of 3 separate units containing something like a series of ShiftBrite modules to indicate the time.

To make it appear like magic I want to make the three of them essentially self contained wireless receiving units.

I was planning on using Xbee but when I times them by three along with the Arduinos they get expensive — four arduino/xbee units gets costly.

So I was wondering if the Xbee could interface directly with something like a Shiftbrite. In my head I think I have it figured out as the ShiftBrites just need serial data control


Many thanks,

James
9  Using Arduino / LEDs and Multiplexing / Re: Sparkfun RGB LED Strip — code issues on: October 05, 2011, 02:37:47 pm
Another go using the WS2801 library.

Code:

#include "WS2801.h"

/*
  Blue = 5V
 Red = SDI
 Green = CKI
 Black = GND
 */

int dataPin = 2; //Red wire (not the red 5V wire!)
int clockPin = 3; //Green wire

WS2801 strip = WS2801(32, dataPin, clockPin);

uint32_t p[4096];

void setup() {
 
  strip.begin();
  strip.show();

  //loaddata();
 
  p[0] = 0xFF3B36;
p[1] = 0xFF1F18;
p[2] = 0xFF1408;
p[3] = 0xFF1703;
p[4] = 0xFF2602;
p[5] = 0xFF3D03;
p[6] = 0xFF5F05;
p[7] = 0xFE8B0A;
p[8] = 0xFEB90D;
p[9] = 0xFEDE0E;
p[10] = 0xFEF40B;
p[11] = 0xFEFC07;
p[12] = 0xFDFE05;
p[13] = 0xF9FF07;
p[14] = 0xF2FF0E;
p[15] = 0xE4FF1E;
p[16] = 0xCBFF39;
p[17] = 0xA5FE60;
p[18] = 0x78FD8F;
p[19] = 0x52F9B9;
p[20] = 0x3DF2DA;
p[21] = 0x3EE6ED;
p[22] = 0x57D2F8;
p[23] = 0x83B6FD;
p[24] = 0xB493FE;
p[25] = 0xDB6BFF;
p[26] = 0xF144FF;
p[27] = 0xFB25FE;
p[28] = 0xFD10FE;
p[29] = 0xFD07FE;
p[30] = 0xFD08FD;
p[31] = 0xFC13FC;
p[32] = 0xFF3933;

}

void loop() {
  for (int x = 0; x < 32; x++) {
    strip.setPixelColor(x, p[x]);
  }
  strip.show();
  delay(100);
}
10  Using Arduino / LEDs and Multiplexing / Sparkfun RGB LED Strip — code issues on: October 05, 2011, 01:42:30 pm
I don't seem to be able to make the strip work with my own code.

The example code works but everytime I try to modify it I can't seem to get it to work ok. I just get the first LED changing colour randomly.

The example code is at http://www.sparkfun.com/datasheets/Components/LED/LED_Strip_Example.pde

Any pointers would be most appreciated!

Here's some code that I've written.

Code:
/*
  Blue = 5V
  Red = SDI
  Green = CKI
  Black = GND
*/

int SDI = 2; //Red wire (not the red 5V wire!)
int CKI = 3; //Green wire
int ledPin = 13; //On board LED

long p[4096];

void setup() {
  pinMode(SDI, OUTPUT);
  pinMode(CKI, OUTPUT);
  pinMode(ledPin, OUTPUT);
  
  
  //clear data in the RGB strip
  for (int x = 0; x < 32; x++) {
    pushRGB(0x000000);
  }
  digitalWrite(CKI, LOW);
  delayMicroseconds(500);
  
  loaddata();
}

void loop() {
  for (int x = 0; x < 32; x++) {
    pushRGB(p[x]);
  }
  digitalWrite(CKI, LOW);
  delayMicroseconds(500);
}

void pushRGB (long colour) {
      for(byte color_bit = 23 ; color_bit != 255 ; color_bit--) {
      //Feed color bit 23 first (red data MSB)
      
      digitalWrite(CKI, LOW); //Only change data when clock is low
      
      long mask = 1L << color_bit;
      //The 1'L' forces the 1 to start as a 32 bit number, otherwise it defaults to 16-bit.
      
      if(colour & mask)
        digitalWrite(SDI, HIGH);
      else
        digitalWrite(SDI, LOW);
  
      digitalWrite(CKI, HIGH); //Data is latched when clock goes high
    }  
}

void loaddata() {

p[0] = 0xFF3B36;
p[1] = 0xFF1F18;
p[2] = 0xFF1408;
p[3] = 0xFF1703;
p[4] = 0xFF2602;
p[5] = 0xFF3D03;
p[6] = 0xFF5F05;
p[7] = 0xFE8B0A;
p[8] = 0xFEB90D;
p[9] = 0xFEDE0E;
p[10] = 0xFEF40B;
p[11] = 0xFEFC07;
p[12] = 0xFDFE05;
p[13] = 0xF9FF07;
p[14] = 0xF2FF0E;
p[15] = 0xE4FF1E;
p[16] = 0xCBFF39;
p[17] = 0xA5FE60;
p[18] = 0x78FD8F;
p[19] = 0x52F9B9;
p[20] = 0x3DF2DA;
p[21] = 0x3EE6ED;
p[22] = 0x57D2F8;
p[23] = 0x83B6FD;
p[24] = 0xB493FE;
p[25] = 0xDB6BFF;
p[26] = 0xF144FF;
p[27] = 0xFB25FE;
p[28] = 0xFD10FE;
p[29] = 0xFD07FE;
p[30] = 0xFD08FD;
p[31] = 0xFC13FC;
p[32] = 0xFF3933;
p[33] = 0xFF2016;
p[34] = 0xFF1808;
p[35] = 0xFF1D02;
p[36] = 0xFF2E02;
p[37] = 0xFF4703;
p[38] = 0xFF6905;
p[39] = 0xFE9309;
p[40] = 0xFEBE0D;
p[41] = 0xFEE10D;
p[42] = 0xFEF50A;
p[43] = 0xFDFC07;
p[44] = 0xFBFE06;
p[45] = 0xF6FF0A;
p[46] = 0xEDFF14;
p[47] = 0xDDFF25;
p[48] = 0xC3FE41;
p[49] = 0x9EFD68;
p[50] = 0x74FB95;
p[51] = 0x52F7BE;
p[52] = 0x42EEDC;
p[53] = 0x47DFEF;
p[54] = 0x60CAF9;
p[55] = 0x8BADFD;
p[56] = 0xB98AFE;
p[57] = 0xDD64FF;
p[58] = 0xF240FE;
p[59] = 0xFB23FE;
p[60] = 0xFC11FD;
p[61] = 0xFC09FC;
p[62] = 0xFA0CFA;
p[63] = 0xF918F9;
p[64] = 0xFF372F;
p[65] = 0xFF2115;
p[66] = 0xFF1C07;
p[67] = 0xFF2502;
p[68] = 0xFF3802;
p[69] = 0xFF5203;
p[70] = 0xFE7305;
p[71] = 0xFE9B09;
p[72] = 0xFEC40C;
p[73] = 0xFEE40C;
p[74] = 0xFDF60A;
p[75] = 0xFCFD07;
p[76] = 0xF9FE08;
p[77] = 0xF2FF0E;
p[78] = 0xE6FF1A;
p[79] = 0xD4FF2D;
p[80] = 0xBAFE4A;
p[81] = 0x97FD71;
p[82] = 0x71F99B;
p[83] = 0x54F3C2;
}

11  Forum 2005-2010 (read only) / Troubleshooting / Re: Snow Leopard and ArduinoBT on: August 29, 2009, 04:25:37 pm
Oh ignore my reply- jumped in a bit quick!
12  Forum 2005-2010 (read only) / Troubleshooting / Re: Snow Leopard and ArduinoBT on: August 29, 2009, 01:02:11 pm
Just posted this in News...

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1251566170/0#0

0017 and Snow Leopard are working perfectly on my macbook pro
13  Forum 2005-2010 (read only) / Syntax & Programs / Re: PROGMEM confusion - storing an int in flash on: November 19, 2010, 06:27:32 pm
Ok the pointer stuff confuses me... smiley

However... the EEPROM write anything is perfect - exactly what I need!

Thanks all!
14  Forum 2005-2010 (read only) / Syntax & Programs / Re: PROGMEM confusion - storing an int in flash on: November 19, 2010, 05:46:09 pm
So I am trying this:

Code:
long collectBytes(byte a, byte b, byte c, byte d) {
  byte* buf;
  buf[0] = a;
  buf[1] = b;
  buf[2] = c;
  buf[3] = d;
  return (long) buf;
}

test2 = collectBytes(0x15, 0xCD, 0x5B, 0x07);

But it's giving me 0 as the output.
15  Forum 2005-2010 (read only) / Syntax & Programs / Re: PROGMEM confusion - storing an int in flash on: November 19, 2010, 05:30:21 pm
Ahhhh now it really works!

Code:
void outputAsBytes(byte* data) {
  for (int i=0; i <= sizeof(data)+1; i++) {
    Serial.println(data[i], HEX);
  }
}

123456789 = 75BCD15

and the output is:

Code:
15
CD
5B
7
Pages: [1] 2 3 ... 8