Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / Re: data converting/parsing help char* to char on: May 09, 2011, 11:30:33 am
All sorted now, thank you very much for the help. FYI @PaulS I did use the code button, it is clearly labelled for even the simple folk such as myself, however the issue was that I selected the "Copy for Forum" option in the arduino IDE hence the italic formatting - apologies.


Nick
2  Using Arduino / Programming Questions / Re: data converting/parsing help char* to char on: May 09, 2011, 10:55:46 am
Sorry about that, I have updated the initial problem / code format. Basically I am trying to compare char* (a) with char* (test1).


Nick
3  Using Arduino / Programming Questions / data converting/parsing help char* to char on: May 09, 2011, 10:24:56 am
Hi,

I'm currently working on using MQTT and Sparkfun's Wifly shield but am a bit stuck as to how to convert the char* a to a char array or compare the char array of 1 variable to another.

Code:
char* test1 = "arduino/test1";
void callback(char *a, uint8_t *b, int c) {
  char buf[15];
  if(a == test1){
    Serial.println("test1!");
  }
  else{}

Above is the function I am having trouble with. With MQTT I am receiving a topic name(a) and a payload(b). For example if I publish topic name: "arduino/test" with the payload: "hello world", the output of the above function would be "arduino/test=hello world". However I can subscribe to mutliple topics but different topics contain different expecting data (one might contain numbers, on might contain floats, chars, bytes etc).

Look forward to any advice about my poorly explained problem smiley

Nick
4  Using Arduino / Interfacing w/ Software on the Computer / Re: 5v and Vin Question on: April 13, 2011, 03:36:29 pm
Lefty,

Your help is greatly appreciated thank you... can finally start the soldering smiley-grin



Nick
5  Using Arduino / Interfacing w/ Software on the Computer / Re: 5v and Vin Question on: April 13, 2011, 03:00:56 pm
Hi Lefty,

Thanks for the reply, I'm sorry but my explanations are terrible (I'm working on it smiley-razz). I was trying to say that, as a completely standalone device (no USB power) could my external supply power both pins, ie give me a 5v pin to use and a 7.2volt pin concurrently?


Nick
6  Using Arduino / Interfacing w/ Software on the Computer / 5v and Vin Question on: April 13, 2011, 12:41:32 pm
Hi Guys,

I just want to be 100% positive of something before I potentially kill some expensive components. If I have a 7.2 Volt external power supply connected to the input jack on the arduino board. Am I ok to use BOTH the 5v pin and the Vin pin without damaging the board/components? The reason being is I have a GPS unit that will only operate between 5-5.5 volts and another component that works best around the 7v mark. I'm 90% sure the answer is yes but I would like to get confirmation for piece of mind >_< (sorry for the silly question).


Nick
7  Using Arduino / Interfacing w/ Software on the Computer / Re: GPS unit -> arduino <-> Processing | serial help needed on: April 08, 2011, 04:06:54 pm
Thanks Paul, being a total amateur I completely forgot about the EEPROM, and yes you understood my poorly written statement perfectly smiley
8  Using Arduino / Interfacing w/ Software on the Computer / Re: GPS unit -> arduino <-> Processing | serial help needed on: April 07, 2011, 07:14:54 pm
Just discovered that While (Serial.available() > 0) doesn't seem to work when using the capacitor jumper to stop arduino resets :S can anyone explain to me perhaps an alternative method to stop me losing my variables when I unplug the arduino?
9  Using Arduino / Interfacing w/ Software on the Computer / GPS unit -> arduino <-> Processing | serial help needed on: April 07, 2011, 05:24:49 pm
Hello,

I am currently making a GPS navigation colour orb (a user held item that changes colour depending on where you are). I have a processing sketch that does some curl scraping to get images and then pixel analysis of those images to get RGB values. From here I then want to send these rgb values over serial to my arduino board. I am currently using a parallax GPS module utilising the NSS library to create virtual serial bridge separate from the arduino to PC one.

User scenario:

My gps unit is sending data every 5 seconds to update the location. My user is to take this orb and plug it into the laptop to download the latest RGB values (they run a processing sketch which sends the data over serial). When the arduino receives these values it pairs them to 5 lon/lat coords which were created on the arduino sketch at compile time.

Note: I am using a 220uF capacitor jumper between the reset and GND pins to stop the the reset when my cable is plugged in/taken out, this is so I can send variables from processing to my arduino without losing the data

Problem:

I am trying to set it up so that when the cable is plugged into the arduino my processing sketch waits for an expected byte to be sent over. When it receives this it starts chucking the RGB data across using a start and endof msg breaks ":" and "<" respectively. Once the data is sent it closes the connection.

Can anyone please enlighten me and tell me if this will work or not? My biggest fear is that the GPS serial bridge will interfere with the arduino > processing one :/
10  Using Arduino / Interfacing w/ Software on the Computer / Re: Ethernet shield + flash on: March 22, 2011, 06:24:24 pm
A bit confusing as to what you are actually trying to make.

Is it a physical tank that you control via flash over TCP/IP stack? Adding video to the mix over the same channel might make things a bit harder. From what I gather you want to turn your arduino/ethernet shield into a web server or web client and interface that with flash?

http://arduino.cc/en/Tutorial/WebClient <- is a good starting point. If you search around on google loads of people have made WiFi controlled RC vehicles.
11  Using Arduino / Interfacing w/ Software on the Computer / Re: rs232 to arduino without resetting board on: March 22, 2011, 06:00:37 pm
problem solved, capacitor jumper...

http://tushev.org/articles/electronics/38-preventing-arduino-from-auto-reset-when-com-port-openscloses
12  Using Arduino / Interfacing w/ Software on the Computer / rs232 to arduino without resetting board on: March 22, 2011, 05:00:04 pm
Hi all,

Possibly a newb question here but endless amounts of googling and I can't find an answer. I have an externally powered arduino board which I want to plug into my laptop as and when to 'receive' variables from a processing sketch via rs232 and to then use these on the already running arduino sketch. Is this possible to do? I'm worried that by plugging the USB cable in, I will reset the code which I don't want to happen, likewise when I take it out will my variables stay there?

The idea is to have a laptop running some algorithms in processing (geoLocative / webscrapey / image analysis stuff) and the user with my arduino orb/device/thing comes and plugs in to download the current data via USB. The bit I'm struggling with is how to get the data from processing to my arduino and to ensure it is stored there.

Idiot question I'm sure but if anyone is aware of any problems this might entail please enlighten me smiley-razz

Nick
13  Forum 2005-2010 (read only) / Interfacing / Re: Pd OSC ints > Processing > Arduino > shif on: January 19, 2011, 02:57:22 pm
Hi guys,

Firstly, Garet thank you for the SSC suggestion, I think that will do nicely as long as I can manipulate the data I'm receiving before passing it through to one of your shiftbrites (ie multiply the value by 100).

I have tried to implement the ssc protocol and can feel I am really close but cannot see where I am going wrong. Whenever I send for example "226" in the serial monitor I get the following:

colour = -1
I received: ΓΏ
this has an ASCII value of -1
Serial reset to: 0
colour = 54
I received: 6
this has an ASCII value of 54
Serial reset to: 0

So it's only seeing the 3rd byte I'm sending (I think this is supposed to happen?)

Arduino Code:

byte s = 0;
int colour = 0;
int SerialCount = 0;

void loop() {
  long now = millis();

  while (Serial.available() > 0) {
    byte s = Serial.read(); //1st byte received of message will be 255
    if (s == 255) {
      SerialCount = 0;
      byte s = Serial.read();
    }
    else if (s != 255 && SerialCount == 0) { //now read the colour value (expected 0-9)
      colour = Serial.read();
      SerialCount++;
      Serial.print("colour = ");
      //colour = colour * 100; //multiply the colour back up to usable number
      Serial.println(colour);

      fadeall(50,1023,0,0,1023,0,colour); //from red to a purple of somesort
      Serial.print("I received: ");
      Serial.println(colour, BYTE); //what byte value did I receive
      Serial.print("this has an ASCII value of ");
      Serial.println(colour,DEC); //what is this in ASCII format
    }
    if (SerialCount > 0 && SerialCount < 2){
    SerialCount = 0; //reset the counter
    }
    Serial.println("Serial reset to: ");
    Serial.print(SerialCount); //confirm it's been reset
  }
}

I did post something up earlier but after reading it it was a bit humiliating on my part! Unfortunately I can't seem to get over this last hurdle. Everyone's help is greatly appreciated and tbh I wouldn't have gotten this far without it smiley-grin I am trying to multiply that number by 100 but it always returns -100.

Nick
14  Forum 2005-2010 (read only) / Interfacing / Re: Pd OSC ints > Processing > Arduino > shif on: January 18, 2011, 11:03:02 am
Hi Paul,

Thanks again for the point in the right direction! I think I am almost there... trying to adapt a bit of AWOL's code from another post to mine but it seems to be concatenating values through the serial monitor. if i type a 1 first its fine... if i then type 33 the next number is 13... then a 3 will pop up. Any ideas on where I'm going wrong?

Code:

char val [10];
int index = 0;

void loop() {
  long now = millis();
  if (Serial.available() > 0) {
    inByte = Serial.read();
    // if (now % 1000){
    val[index++] = inByte;
    val[index] = '\0';
    int a = atoi(val);
    Serial.println(a);
      if (a > 0 && a < 60){
        fadeall(50,1023,0,0,0,0,1023); //from red to blue
      }
      else if (a > 60){
        fadeall(50,0,0,1023,1023,0,0); //from blue to red
      }
      else {
      }
      if (inByte <= '0' || inByte >= '9') {
        index = 0;
      }
    a = 0;
    //Serial.flush();
    //  }
  }
}
15  Forum 2005-2010 (read only) / Interfacing / Re: Pd OSC ints > Processing > Arduino > shif on: January 18, 2011, 08:31:31 am
Sending commands through the monitor works fine... What would be the best logical way of reading serial data in real time and then writing the incoming data on the fly?

Is anyone aware of how arduino interprets the port.write(int); method in processing... ie does it recognise the byte as an integer or do I have to convert it with atoi? Processing seems to do the conversion for me which I think is why I'm getting different results from the arduino?

Thanks again for the advice so far!
Pages: [1] 2