Show Posts
Pages: 1 ... 11 12 [13] 14 15 16
181  Forum 2005-2010 (read only) / Syntax & Programs / Re: changing a 16bit binary number into two 8-bit byte on: September 28, 2010, 12:50:58 pm
Union is also good for cutting variables to pieces and making them whole again.

At least in other C compilers, I have not tried it in Arduino.
182  Forum 2005-2010 (read only) / Syntax & Programs / What is the status of Ethernet Shield SW on: July 26, 2010, 04:05:39 pm
I found a lot of old posts about problems. I hope those problems are fixed now. Is there something I should know before connecting 10+ shields with 2009s to a network.

183  Forum 2005-2010 (read only) / Syntax & Programs / Re: Using Visual Studio as a code formatter on: July 11, 2010, 05:00:24 pm
My friends preach about "SQL WINDOWS" 20-30 years ago, which was better then than what VS is now. But that's an other story. And VS is here now but SQL W isn't.

Thanks for the tips by the way.
184  Forum 2005-2010 (read only) / Syntax & Programs / Re: Using Visual Studio as a code formatter on: July 10, 2010, 02:46:08 pm
Good to hear about auto format. After a quick look I like more heavily indented code.
185  Forum 2005-2010 (read only) / Syntax & Programs / Using Visual Studio as a code formatter on: July 10, 2010, 12:41:17 pm
Hi all
This is not a question, but rather like a answer to my question.

I have a large program, for me atleast. It has many nested IFs and other blocks. I got more and more confused where blocks ended. Indenting code helps, but sloppy indenting does not. And commenting blocks with { makes this even more difficult. So, I tried to copy paste all code to Visual studio 2008 C++ file. And back to Arduino IDE.

In Visual Studio there is in edit/advanced menu, some interesting choices. Somehow I managed to get my code properly indented. (Start with "select all".) I'll check it better next time I need it.

Now my code is easier to follow in Arduino IDE too.

Have you any comments. Better ways to do this.

Well at least I hope this helps some one.
186  Forum 2005-2010 (read only) / Syntax & Programs / Re: Best way to "run multiple sketches"? on: July 09, 2010, 09:19:41 am
So unions work with Arduino or its compiler after all. I thought it was said in here Arduino forums that they wont work.
187  Forum 2005-2010 (read only) / Syntax & Programs / Re: Problem with Char() function on: June 02, 2010, 02:57:34 am
Your code works, thanks.

I wonder is the char() help page a little short or misleading.

Here is the whole program if somebody happens to need it.

Code:
char plaa[100];  // don't build more than 99 chars to this!
int val = 0;                    // variable for reading the pin status
char firstStg[8];
void setup()
{
  Serial.begin(9600);
}
void loop()
{
val++;
plaa[0]='\0';
itoa(val, firstStg, 10); // 3rd argument is base, not size (10 is decimal)
strcpy(plaa, "haly=");
strcat(plaa, firstStg);
Serial.println(plaa);
delay(1500);
}
188  Forum 2005-2010 (read only) / Syntax & Programs / Problem with Char() function on: June 01, 2010, 04:50:11 pm
I am playing with strcat and char functions. I am trying to get a result something like " haly=44" in a text variable "plaa".
Code:
int first = 0;    
int  inByte;
char ppp;
void setup()
{
  Serial.begin(9600);
}
void loop()
{
  if (Serial.available() > 0) {
    inByte = Serial.read();
    first++;
    char plaa[]="haly=";
    strcat(plaa," hh");
    ppp=char(first);
    strcat(plaa,ppp);
    Serial.println(plaa);
  }
}
But I get error:
 In function 'void loop()':
error: invalid conversion from 'char' to 'const char*'

In char() documentation in references, there is nothing special mentioned. I have tried many ways to declare the char variable, but nothing seems to help. Is something missing or do I have to make this a full C++ program with libraries and so on.  And eat Arduino's memory.
189  Forum 2005-2010 (read only) / Syntax & Programs / Re: Serial communication within Windows XP to Arduino on: September 16, 2009, 01:40:39 pm
I have never really read FTDI data sheets, but I know there are interesting utilities in FTDI homepage.

This comes late, but did you get your program working
190  Forum 2005-2010 (read only) / Syntax & Programs / Re: Serial communication within Windows XP to Arduino on: September 15, 2009, 02:34:55 pm
Make Arduino to reply with certain code when you send something to it via serial port. If you get the right reply you have the right port. There are more exotics ways (to detect usb serial ports) but this is easy to understand.
191  Forum 2005-2010 (read only) / Interfacing / Re: Strange Serial Port Problems on: September 22, 2009, 01:14:55 pm
I am guessing, but as now one else is helping, how about this:
I had problems with RESET-EN coming active. When I started my pc or VB ide, Arduino changed to programming state. But this was different in two pc's. Maybe this can happen with Macs too.

I had to cut the jumper in RESET-EN track. Now I cant program Arduino before I solder the jumper again, but now Arduino works with the program it has.
192  Forum 2005-2010 (read only) / Interfacing / Re: Ardurino with Visual Basic ? Possible or Not? on: September 15, 2009, 02:37:39 pm
True

And there is a Microsoft forum for visual basic. There are whole examples of this, if you search a little.
http://social.msdn.microsoft.com/Forums/en-US/vblanguage/threads
If you register, you can ask basic questions, at least I could.
193  Forum 2005-2010 (read only) / Interfacing / Re: Ardurino with Visual Basic ? Possible or Not? on: September 14, 2009, 04:36:06 pm
Good to hear. There seems to be differences on pcs.

Here it worked if I connected Arduino when Visual studio was running. Put if I shatdown the pc or if I put the computer to stand by, Arduino stopped working.
194  Forum 2005-2010 (read only) / Interfacing / Re: Ardurino with Visual Basic ? Possible or Not? Yes on: September 14, 2009, 02:01:39 pm
Yes it is possible. But look out for RESET-EN.

When you start Windows or Visual basic there is glicth on DTR pin from Windows. It is connected to Reset-en and puts Arduino in wrong state.

First I made a program with Arduino ide. And put that into Arduino. Then I cut reset-en jumper. Then you can work with visual basic without problems with Arduino. But remember, before a new program can be loaded into Arduino, that jumper must be fixed.
195  Forum 2005-2010 (read only) / Interfacing / Re: How to start USB bus in Arduino board on: April 19, 2009, 12:09:03 pm
I think we can use this board.

There could be some more io but you can't get everything.

For curious:
A friend of mine is going to write some pc programs reading and writing usb com port.  And my job is to handle some hw devices with usb/serial data.

Thanks
Pages: 1 ... 11 12 [13] 14 15 16