|
1546
|
Using Arduino / Programming Questions / Re: menu question
|
on: June 29, 2012, 04:18:32 pm
|
Is this the function you are asking about? void menuChanged(MenuChangeEvent changed){
MenuItem newMenuItem=changed.to; //get the destination menu
lcd.setCursor(0,1); //set the start position for lcd printing to the second row
if(newMenuItem.getName()==menu.getRoot()){ lcd.print("test 1 "); }else if(newMenuItem.getName()=="Item1"){ lcd.print("Item1 "); }else if(newMenuItem.getName()=="Item2"){ lcd.print("Item2 "); }else if(newMenuItem.getName()=="Item3"){ lcd.print("Item3 "); } }
If so, what don't you understand about it?
|
|
|
|
|
1547
|
Using Arduino / General Electronics / Re: Relay Wiring
|
on: June 29, 2012, 04:15:29 pm
|
|
With a transistor "on" is with the base pulled away from the potential of the emitter.
For an NPN transistor that would be a positive voltage WRT emitter (usually ground). For a PNP, the emitter is usually connected to Vcc, so it would be a negative voltage WRT Vcc, so anything below Vcc (i.e., VOL, or "logic low").
|
|
|
|
|
1548
|
Using Arduino / Programming Questions / Re: menu question
|
on: June 29, 2012, 04:09:25 pm
|
|
Handmade crochet bag with coordinate necklace anyone?
If you don't follow this up with actual code, rather than a link to some random site, I'll flag it for the mods to delete as spam.
|
|
|
|
|
1550
|
Using Arduino / Programming Questions / Re: Converting char to unsigned int?
|
on: June 29, 2012, 01:41:44 pm
|
|
Then you're asking completely the wrong question. We have answered the question you asked with the right answer.
You should be asking about string parsing, which is a completely different topic (and something already heavily covered in the forum).
|
|
|
|
|
1551
|
Using Arduino / Programming Questions / Re: How can I calculate processor usage?
|
on: June 29, 2012, 08:46:31 am
|
|
A microcontroller is somewhat different to a PC.
A PC has many many tasks running concurrently, organized and managed by a scheduler.
A Microcontroller typically only has one task and no management.
A PC switches between tasks, timing the amount of time spent in each task, the amount of time spend handling interrupts, the amount of time spent doing system (kernel) tasks, and the amount of time when not doing anything.
A microcontroller is either running or it isn't.
If the microcontroller is running, then it is at 100% usage. If it's not, then it's asleep and waiting to be woken by some interrupt (or it's turned off).
|
|
|
|
|
1554
|
Using Arduino / Programming Questions / Re: Pressure differential sensor, analog input issue
|
on: June 29, 2012, 04:43:28 am
|
Due to function overloading, if the first parameter is a floating point number the second parameter is taken as the precision, not the base. OCT is a macro equating to 8...
That's not how to use it, in my opionon. I thinks it's even erroneous misusage of something not ment for it. Oh, I never said it was right - I was just describing the effects of using it like that. I have an emulator for that 
|
|
|
|
|
1556
|
Using Arduino / Programming Questions / Re: Pressure differential sensor, analog input issue
|
on: June 29, 2012, 04:23:59 am
|
Is the sensor a flow sensor ? Can you tell which one and add a link to it ? (just copy the url in the message). In your code, the flow sensor must output 0V if there is no flow. You use octal ('OCT') notation for a double precision floating point. http://arduino.cc/it/Serial/PrintBut the octal notation is only used by old programmer pioneers with long white beards. Just use "Serial.println(volFlow);" to print a floating point number, or "Serial.println(volFlow,3);" with 3 digits after the comma. The same goes for the 'tank' variable. Due to function overloading, if the first parameter is a floating point number the second parameter is taken as the precision, not the base. OCT is a macro equating to 8, so printing a floating point number with OCT will yield a floating point number with 8 decimal place precision. It will not display it as octal. And I am neither old (well, not that old), and I don't have a grey beard (neither do I wear sandals), yet I do use octal on a daily basis. It is no more "old fashioned" than hexadecimal - it's just a different way of grouping bits - 3 instead of 4.
|
|
|
|
|
1559
|
Using Arduino / Programming Questions / Re: Converting char to unsigned int?
|
on: June 29, 2012, 03:38:54 am
|
You can convert a char array to an integer using atoi: char *in = "4793"; int out = atoi(in);
However, that creates a signed integer between -32768 and 32767. For unsigned I would suggest using its sister function "atol" to convert to a signed long, then cast that back to an unsigned int. That way the long can store the numbers greater than 32867, and the casting will retain anything between 0 and 65535. char *in = "49283"; long temp = atol(in); unsigned int out = (unsigned int)temp;
|
|
|
|
|
1560
|
Using Arduino / Programming Questions / Re: Char array not being remembered or overwritten
|
on: June 29, 2012, 03:34:32 am
|
char data[1024]; char number[1024]; char message[1024]; char waste[1024]; On what Arduino? On any Arduino with enough memory. A better question is "What makes an Arduino an Arduino". I have a system on my desk with 128K of RAM and 512K of Flash. It uses the Arduino IDE. It uses the Arduino libraries. It uses Arduino shields. It's programmed using avrdude... Is it an Arduino...?
|
|
|
|
|