Show Posts
Pages: [1] 2 3
1  Forum 2005-2010 (read only) / Troubleshooting / Re: Windows setup on: September 05, 2009, 06:42:15 am
Ahh yes I'm not using the Admin account - it's a borrowed laptop and I only have a user login. Will need to check with the administrator.

Thanks a million for the tip.

Jim H
2  Forum 2005-2010 (read only) / Troubleshooting / Windows setup on: September 04, 2009, 09:22:52 am
Hi Folks,

I've used my Arduino with my Mac fine and I'm trying to get it to work with a PC (xp) but it's acting up!

The TX LED blinks around 40 times but then stops when I connect, or open the Arduino environment, or try to upload.

I've never seen the RX LED light at all - if that explains anything.

Any thoughts or advice would be much appreciated.

Cheers

Jim H
3  Forum 2005-2010 (read only) / Interfacing / Re: Arduino v.s. i Cube X on: August 19, 2009, 10:35:33 am
Presumably all of the iCubeX sensors can be used directly with the Arduino considering they are all 5V?

Jim H
4  Forum 2005-2010 (read only) / Interfacing / Graphical User Interface (GUI) for Arduino on: August 08, 2009, 01:57:08 pm
Hi Folks,

After a lot of hair-pulling work I'm finally coming to the point of finishing my Graphical User Interface for the Arduino. At the moment it only runs on Mac but with some help it shouldn't be difficult to port it to windows too.

What I really need are a few folk to beta-test it for me and wonder if anyone would be willing to try it out? I'm especially in need of folk who can help me test a PC version since I don't have a PC of my own.

Let me know if you're interested.

Thanks

Jim
5  Forum 2005-2010 (read only) / Interfacing / Re: Analog In Number Format on: August 15, 2009, 04:28:16 pm
Mem - Brilliant, brilliant, brilliant!

A few tweaks and it works perfectly!

Code:
   // read and print the analog input on pins 0 -> 5:
    int i;
    char b[] = "@*$%^!";
    for (i = 0; b[i] != '\0'; i++)
    {
      Serial.print(b[i]);  
      int val = analogRead(i);
      for(int pad = 1000; val < pad; pad /= 10)
        Serial.print('0');
      Serial.println(val);
    }

Thanks a million.

Jim H
6  Forum 2005-2010 (read only) / Interfacing / Re: Analog In Number Format on: August 15, 2009, 12:18:56 pm
Thanks Spinlock.

I'm getting an error though:

"In function 'void do_command(char)':
error: 'sprintf' was not declared in this scope"

Any ideas?

Jim H
7  Forum 2005-2010 (read only) / Interfacing / Re: Analog In Number Format on: August 15, 2009, 11:47:53 am
Hmmm, that's an interesting option but it would be much easier in terms of filtering if I could get the Arduino always to output a 4digit reading after the identifier character.

Jim
8  Forum 2005-2010 (read only) / Interfacing / Analog In Number Format on: August 15, 2009, 09:48:15 am
Hi Folks,

I have the following code gathering the Ain data and appending a identifier character before writing to the serial port:
Code:
{
      // read and print the analog input on pins 0 -> 5:
      int i;
      char b[] = "@*$%^!";

      for (i = 0; b[i] != '\0'; i++)
      {
        Serial.print(b[i]);
        Serial.println(analogRead(i));
      }
      break;
    }
However, Occasionally the first and last lines skip the last characters and I get rogue readings.

Is there a way to format the output to 4 decimal places so that I get readings something like this:

@0001
*0024
$1024
%0011

etc? This way I can filter out the rogue readings afterwards.

Any advice greatly appreciated.

Best

Jim H
9  Forum 2005-2010 (read only) / Interfacing / Re: Serial Interface on: December 24, 2008, 05:45:02 pm
Well, it works but it's not pretty!!

One thing which stumped me for a while is that it needs both lines of      
Quote
Serial.print("it is ");
     Serial.println(c);
otherwise nothing else happens. I'm assuming this forces something to happen which I have missed but I can't work out what that is.
Quote
void loop()
{
  static char buffer[] = "000";
  static int received = 0;
  if (Serial.available())
  {
    char c = Serial.read();
    if (c == '@')
    {
      Serial.print("it is ");
     Serial.println(c);
      
      if (Serial.available())
      {
        char d = Serial.read();
          if (d >= '0' or d <= '9')
          {
        buffer[received++] = d;
          }
      }
      if (Serial.available())
      {
        char e = Serial.read();
                  if (e >= '0' or e <= '9')
          {
        buffer[received++] = e;
          }
      }
      if (Serial.available())
      {
        char f = Serial.read();
                  if (f >= '0' or f <= '9')
          {
        buffer[received++] = f;
          }
      }
      if (buffer[received] == '\0')
      {
        Serial.print("Buffer full, value: ");
        Serial.println(buffer);
        analogWrite(PWMPIN3, atoi(buffer));
        received = 0;
      }
    }
Anyway, since Christmas is almost upon us I'm going to let this stew for a while - maybe a solution will come to me. If not you'll be hearing from me again.

Merry Xmas.

Jim H
10  Forum 2005-2010 (read only) / Interfacing / Re: Serial Interface on: December 24, 2008, 01:18:57 pm
Good advice. Thanks.

Lots of if Serial.available() to add then I guess!

Cheers

Jim H
11  Forum 2005-2010 (read only) / Interfacing / Re: Serial Interface on: December 24, 2008, 09:53:11 am
Sorted it! - a curly in the wrong place - I had the 2nd "if" inside the 1st.


Thanks again.

Jim H
12  Forum 2005-2010 (read only) / Interfacing / Re: Serial Interface on: December 24, 2008, 09:00:57 am
Stuck again trying to create a method to differentiate the incoming commands for different PWM pins:
Quote
void loop()
{
  static char buffer[] = "000";
  static int received = 0;
  if (Serial.available())
  {
    char c = Serial.read();
    // if (incomming is an identifier character)
    if (c == '$')
    {
      Serial.print(c);
      Serial.println(" is our identifier character");
      char d = Serial.read();
      buffer[received++] = d;
      char e = Serial.read();
      buffer[received++] = e;
      char f = Serial.read();
      buffer[received++] = f;
      if (buffer[received] == '\0')
      {
        Serial.print("Buffer full, value: ");
        Serial.println(buffer);
        analogWrite(PWMPIN3, atoi(buffer));
        received = 0;
      }
    else if (c == '@')
    {
      Serial.print(c);
      Serial.println(" is our identifier character");
      char d = Serial.read();
      buffer[received++] = d;
      char e = Serial.read();
      buffer[received++] = e;
      char f = Serial.read();
      buffer[received++] = f;
      if (buffer[received] == '\0')
      {
        Serial.print("Buffer full, value: ");
        Serial.println(buffer);
        analogWrite(PWMPIN5, atoi(buffer));
        received = 0;
      }
    }
    }
    else // Not a PWM command, check for further input commands
    do_command(c);
    Serial.print("c is still ");
    Serial.println(c);
  }
}

Any thoughts?

Many Thanks again and a Very Merry Xmas!

Jim H
13  Forum 2005-2010 (read only) / Interfacing / Re: Serial Interface on: December 23, 2008, 10:23:23 am
"Silly" mistakes or no, it works perfectly now!!

For a while there I thought it might just not be possible to have so many messages going back and forth without dropping data - you proved me well and truely wrong.

Thanks so much for you're expert help - I really appreciate it.

Jim H
14  Forum 2005-2010 (read only) / Interfacing / Re: Serial Interface on: December 23, 2008, 03:52:30 am
Debugging statements - great! Now the problem becomes much clearer:
Quote
A
Received value is A is a numeric character
B
Received value is B is a numeric character
1
Received value is 1 is a numeric character
Buffer full, value: AB1
The characters are being treated as numbers and are being put into the buffer even when they were created as "char"????
15  Forum 2005-2010 (read only) / Interfacing / Re: Serial Interface on: December 22, 2008, 06:19:09 pm
That beautifully simplified version compiles fine but unfortunately I get no response using it at all. I'm having a little more success with stripping out the surplus "Serial.Read" from the older version, as you suggested, but I'm still not getting faultless responses to commands sent from the console. It does follow a pattern though - if I send a string of 6 letters the 3rd Pin and the 6th Pin don't respond so presumably the third character is being swallowed up somewhere?

Any thoughts?

Cheers

Jim H
Pages: [1] 2 3