Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 15
61  Using Arduino / Programming Questions / Re: Passing char arrays to a function - best practice on: September 11, 2012, 04:40:41 am
maybe its more handy to know what pointers are.
suppose that you do something like this

int A = 10;

Then well thats easy a variable A got assigned a value of 10
But computers dont store the whole alphabet, and your "A" is just easy to read and handy to work with.
In reality this "A" is stored somewhere.
Imagine if the arduino memory where a street, each house might contain some value like an "A".
Now the easiest way to retrieve those values would be if someone told you to go to the address of a house and retrieve what it has stored.
This address points you to where it is stored, so POINTERS simply refer to places in memory.

There is a lot of fun that you can do with pointers, because they are not only used for simple variables
One could store also an object in an house, and that object could contain more values, like your array.

But there are even more interesting things you might store in a house
For example you could put in an object that not only contains an some value, but also the address of the next house to visit and the previous house, and maybe even the house address of the first sidelane.
Such more complex objects allow for the creation of database like structures.. In fact databases are made like that.

So from something simple as a pointer, you can get into complex stuff and store any kind of information structure.

Now the speed you get from it is that you only have to refer to something by a pointer and dont have to cast it into another variable for some complex things (like your function).
And well it might look a bit scary, its to good to learn about this topic a bit. There are things you can do with it for wich they are handy.


62  Using Arduino / Programming Questions / Re: Analogwrite problem on: September 10, 2012, 05:27:37 pm
please use code tags when posting
ehm did you forgot // marks in your setup part.
is see you also use it once / but it should be double //
oh and i think analog write can only have values between 0 and 255
63  Using Arduino / Programming Questions / Re: Passing char arrays to a function - best practice on: September 07, 2012, 08:14:29 am
please try to adjust your sendmsg function like this, i believe it should work.
Code:
void SendMsg(char * myMsg)    // << points to your array and that should be enough, a basic c++ method
{
  char MsgAndTime[strlen(myMsg) + 10];  
  strcpy(MsgAndTime, myMsg);  
  strcat(MsgAndTime, " 1:00 PM");
  Serial.println(MsgAndTime);
}

notice only the main calling method is changed the way you would if calling for an array function variable.
if it doesnt work then arduino isnt c++ compliant but i dont doubt it wouldnt work like this.
64  Using Arduino / Microcontrollers / Re: next Arduino board on: September 06, 2012, 03:55:17 pm
yeah well we see that the arm processors these days have usb support in arduino (leonev) but hm i see also chips like http://www.atmel.com/products/microcontrollers/wireless/default.aspx some atmel chips have it inside.
65  Using Arduino / Microcontrollers / next Arduino board on: September 06, 2012, 03:25:01 pm
Well i wonder is Teensy 3.0 the next major arduino release (based on its specs), it seams quite something special
http://www.kickstarter.com/projects/paulstoffregen/teensy-30-32-bit-arm-cortex-m4-usable-in-arduino-a

Or will there be a wifi enabled next major board?.
66  Using Arduino / Programming Questions / Re: How to send http strings on: September 04, 2012, 05:28:59 pm
try fidler  instal it on your pc to findout the requred commands its a IExplorer add on 
or use netmon if your into networking
67  Using Arduino / Programming Questions / Free 3 year license for visual studio 2010 on: September 04, 2012, 10:15:16 am
i stubled on this news announcement http://www.visualmicro.com/page/Offer-Visual-Studio-Professional-Free-For-3-Years.aspx.
After you have it you can use http://arduino.cc/playground/Code/VisualStudio to work on sketches from within visual studio c++
Visual studio is an excelent programming editor, note however that arduino c++ editor tool starts up a bit faster.
But visual studio is a profesional programming packet (not limited to only arduino or only c++)
68  Using Arduino / Programming Questions / Re: For loops?? on: September 03, 2012, 06:22:05 pm
ok just wrote something simple.. you can ad more if lines if you have more leds, code is real short i guess it should work, not tested it.
Code:
setup{
state1=false;
state2=false;
int pin1=1;
int pin2=2;
int x =0;
PinMode(pin1,OUTPUT);
PinMode(pin2,OUTPUT);
}

// a short method using modulo function >> % <<

void loop(){
x++
if(x%3==0)   {state1=!state1;digitalWrite(pin2,state2);}
if(x%13==0) {state2=!state2;digitalWrite(pin2,state2);}

delay(.....)
}
69  Using Arduino / Programming Questions / Re: Counting pulses on: September 03, 2012, 06:03:43 pm
somthing like get the current milies time
endtime = milies + xxxxx
while (milies < endtime)
{ readpin readsignalstate
  if (readsignalstate!=lastState){count++;lastState=readsignalState;}

}


70  Using Arduino / Programming Questions / Re: How to send http strings on: September 03, 2012, 05:50:50 pm
might be handy two other methods to send a string :

http://www.stringmail.co.uk/

http://www.pantybypost.com/shop/
71  Using Arduino / Microcontrollers / Re: What's the best way to clone the whole SW in CPU and preventing others doing it on: September 03, 2012, 05:13:16 pm
ehm.. 20cm of re-enforced concrete


just joking.. i think everything is hackable.
72  Using Arduino / Programming Questions / Re: Wiegand RFID ID Number on: September 02, 2012, 06:17:37 pm
whatever you like after reading this
https://docs.google.com/viewer?a=v&q=cache:-N798TI0M10J:www.hidglobal.com/documents/understandCardDataFormats_wp_en.pdf+&hl=en&gl=nl&pid=bl&srcid=ADGEESgtO8OCgUEtQxXsRKtS_i4buUE03Z4dIe_vSU92YgvNl_KmOvTut-Fjx9fqisEWCvZfQbuZ-ogbXJYCB885HiQ9moQC0kCInJ0Cq8E23q_Eh_0lnZc0cDnNe6WIDtXi9jD27DUu&sig=AHIEtbROMxgfNk-YFfQdnzbp4FYgqhEQmQ&pli=1
73  Using Arduino / Programming Questions / Re: Adding ethernet library from the arduino IDE results in multiple #includes on: September 02, 2012, 06:12:58 pm
<small add on>

oh and note that SPI is a general interface protocol, to talk against a ethernetcar a gps or whatever.
the code for a network card might go trough a SPI (most likely) but there are different hardware network solutions, so there might be different code too to drive those solutions.
74  Using Arduino / Programming Questions / Re: Adding ethernet library from the arduino IDE results in multiple #includes on: September 02, 2012, 06:10:11 pm
as i explained earlier you might not need them all. (or perhaps you do)
programmers of librariers often present you everything, that doesnt mean that your code needs everything
but if they didnt provide it, you had to guess the names.. seams a bit harder to me
and now you can delete lines that you dont need (or mark them out).

simply mark out check if the code still works if ok you dont need it, if it stops you needed it.


I cannot tell you if the code examples you refer to are from the same date as this library
programmers can change whats in their code and how it works, and how it is divided accros their binaries.
75  Using Arduino / Programming Questions / Re: How do I know if I'm using the string class on: September 02, 2012, 06:02:31 pm
see the class's funstions http://arduino.cc/en/Reference/StringObject
Pages: 1 ... 3 4 [5] 6 7 ... 15