Show Posts
Pages: [1] 2 3
1  Using Arduino / General Electronics / SN74181 on: February 25, 2014, 07:16:51 pm
How does one wire up such a thing. understandably I use switches for my A and B inputs also for the S functions, do these need to be grounded instead of applied with 5v? Also what are the purposes of the Generate and propogate functions with the TTL, my textbook does not go into depth with this IC
2  Using Arduino / Programming Questions / Re: Using floats. on: September 29, 2013, 10:21:26 am
Why is DELTA being used. Is delta the allowed difference between a & b?
How would you describe the if functions of a & b?
Also, given that when I run the code the value being printed is -0.0000001 which is the most allowed to be printed. 7 digits.
3  Using Arduino / Programming Questions / Using floats. on: September 29, 2013, 08:42:22 am
I'm using the Arduino cookbook in which to understand the C+ programming.
This is one of the examples given on using the floating-point numbers. Understandably I get that
the number cannot equal exactly zero; however, I don't know what is meant exactly with the almostequal function
utilizing the return and fabs coding at the bottom. I just need a simple explanation.
Thank you for your time.

Code:
/*
floating-point example
*/


float value = 1.1;

void setup() {
  Serial.begin(9600);
}

void loop() {
  value = value - 0.1;
  if (value == 0) {
    Serial.println("the value is exactly zero");
  }
  else if (almostEqual(value, 0)) {
    Serial.print("the value");
    Serial.print(value,7); // print to 7 decimal places
    Serial.println(" is almost to equal");
  }
  else {
    Serial.println (value);
  }
  delay(100);
}
  //returns true if the difference between a and b is small
  // set value of DELTA to the maximum difference considered to be equal


boolean almostEqual(float a, float b) {
  const float DELTA = .00001; // max difference to be almost equal
  if (a == 0) return fabs(b) <= DELTA;
  if (b == 0) return fabs(a) <= DELTA;
  return fabs((a - b) / max(fabs(a), fabs(b))) <= DELTA;

}
4  Using Arduino / Programming Questions / Re: What is the difference between C and C++ on: March 04, 2013, 12:12:55 am
Quote
class, virtual, const, public, protected, private, template, friend, overloading, and name mangling.
What does all this mean?
5  Using Arduino / Programming Questions / Re: What is the difference between C and C++ on: March 04, 2013, 12:02:34 am
So really just the structuring and keywords are the only distinction; therefore, there is no difference between the two.
Does one work better than the other with certain types of hardware?
6  Using Arduino / Programming Questions / What is the difference between C and C++ on: March 03, 2013, 11:47:38 pm
Which is better to use?
7  Using Arduino / Programming Questions / Re: May someone please go into detail what %s & other similar %'s. on: March 03, 2013, 10:30:45 pm
Perfect, thank you!
8  Using Arduino / Programming Questions / May someone please go into detail what %s & other similar %'s. on: March 03, 2013, 09:13:36 pm
Sorry, however; I've just begun to work with strings and this is a new topic I have just come across.
9  Using Arduino / Programming Questions / Re: have a question.. on: February 24, 2013, 11:13:29 pm
What are the differences between the 4 drop down menu options at the bottom of the Serial monitor.

No line ending
Newline
Carriage return
NL/CR
10  Using Arduino / Programming Questions / Re: Converting String to Number on: February 24, 2013, 09:20:46 pm
What does that mean?
11  Using Arduino / Programming Questions / Re: Converting String to Number on: February 24, 2013, 08:06:16 pm
Quote
Try changing the drop down to "newline"
What are the differences between the 3 possible selections of
No line ending
Newline
Carriage return

and the last being Newline and carriage return together
12  Using Arduino / Programming Questions / Re: Converting String to Number on: February 24, 2013, 07:57:03 pm
Quote
Simple servo code that might be of interest
That example works great!
I'm using an Arduino Cookbook and going through it page by page to understand the c language. It; however, does not explain well what is actually happening in english within the program. Thank you very much for your help zoomkat and PaulS

Code:
He means you can use Serial.print to send data to the screen that might be helpful in debugging.

Oh... Thank you Arrch
13  Using Arduino / Programming Questions / Re: Converting String to Number on: February 24, 2013, 07:40:47 pm
I'm merely placing a 1 through 5 with no sort of trigger and hitting send.

What do you mean by what the Arduino is receiving?
14  Using Arduino / Programming Questions / Re: Converting String to Number on: February 24, 2013, 07:25:03 pm
Nothing happens to the LED, when I do put a number of 1-5.
15  Using Arduino / Programming Questions / Re: Converting String to Number on: February 24, 2013, 07:15:27 pm
isDigit gets its value from the ch. So, Serial.read is a number that I write into the serial monitor?
Pages: [1] 2 3