As I already specified... If you are wishing MrDeb well in this C++ endeavor, Its a big leap and I applaud him for making the move..
If all you want todo is bring him down, then I will threadban the neigh sayers... Lets give our support... C and C++ isn't as forgiving as basic, so think before you post..
As I've specified and stated on many occasions, I believe MRDEB to be a troll and he's never denied it once. Now he has the moderators helping in his endeavours. I tried to help him about 10 years ago. His questions haven't changed in that time. I now stay away from his threads for this reason.
FWIW, and I may be wrong, some_of_us are simply not wired for programming, no matter how hard we try, but others are.
Some of us are able to comprehend lefty-loosey and righty-tighty without a problem, design fantastic structures and products, produce polymers and chemicals that make all of our lives easier, or open up a body and fix it following an accident or illness...
What is easy for one, is not easy for all.
I would love to be proficient at programming, but it's not going to happen because I am much more inclined to solve mechanical problems, which are far easier to visualize to me.
We do and get paid for the things we are good at, and pay someone else to do the things we aren't.
No. I believe he was referring to the syntax of subroutines in Arduino, rather than not understanding what a subroutine is. MrDEB is not overly exact in his use of language.
YES I know what a sub routine is, have used numerous times. Hoping the book "LEARN ARDUINO IN 24 HOURS" will get to that section soon. Still pondering with the IR remote code. Set up a SWITCH CASE routine and seems to work well but now I need the remote to "train" the UNO to remember the output from the remote then add several subroutines to the code.
lately having issues with the Arduino IDE locking up and after the ctr, alt, delete I end task and it shows "Java(TM) platform SE binary(32bit)
any thoughts as to why?
lately having issues with the Arduino IDE locking up and after the ctr, alt, delete I end task and it shows "Java(TM) platform SE binary(32bit)
any thoughts as to why?
Musicmanager inquired about the ARDUINO PROGRAMMING IN 24 HOURS"
here is a list of the books I recently purchased. The first one is Arduino in 24 hours
Arduino Cookbook: Recipes to Begin, Expand, and Enhance Your Projects [Margolis, Michael, Jepson, Brian, Weldin, Nicholas Robert] on Amazon.com. *FREE* shipping on qualifying offers. Arduino Cookbook: Recipes to Begin, Expand, and Enhance Your Projects
this looks right but hangs up on line 40 a "printin statement? I corrected hopefully all the typos?
Code:
const int micPin = A0; //MIC PORT
const int LedPin = LED_BUILTIN; //FLASH BUILT IN LED
const int numberOfSamples = 128; //NUMBER OF READINGS
const int middleValue = 512; //MIDDLE OF RANGE
int sample; //VALUE FROM MIC
long Signal; //READING AFTER DC OFFSET
long newReading; //AVERAGE OF LOOP READINGS
long runningAverage = 0; //CACULATED VALUES
const int averagedOver = 16; //HOW QUICK NEW VALUES AFFECT RUNNING AVG
const int threshold = 400; //AT WHAT LEVEL LED COMES ON
void setup()
{
pinMode(LedPin, OUTPUT); //
Serial.begin(9600);
}
// put your setup code here, to run once:
void loop()
{
long sumOfSquares = 0;
for (int I = 0; I < numberOfSamples; I++) { //average readings
sample = analogRead(micPin); //take a reading
Signal = (sample - middleValue);
Signal *= Signal; //SQUARE IT
sumOfSquares += Signal; //add to the total
}
newReading = sumOfSquares / numberOfSamples;
//caculate running average
runningAverage = (((averagedOver - 1) * runningAverage) + newReading) / averagedOver;
Serial.print("new:"); Serial.print(newReading);
Serial.print(".");
Serial.print("running:");
Serial.printin(runningAverage);
if (runningAverage > threshold) { //is average more than threshold?
digitalWrite(LedPin, HIGH);
} else {
digitalWrite(LedPin, LOW;
}
}
// put your main code here, to run repeatedly:
}
Ah ! I found a couple of others too .. .. this compiles OK, but you need to make sure you can see the differences .. OK ?
C:
const int micPin = A0; //MIC PORT
const int LedPin = LED_BUILTIN; //FLASH BUILT IN LED
const int numberOfSamples = 128; //NUMBER OF READINGS
const int middleValue = 512; //MIDDLE OF RANGE
int sample; //VALUE FROM MIC
long Signal; //READING AFTER DC OFFSET
long newReading; //AVERAGE OF LOOP READINGS
long runningAverage = 0; //CACULATED VALUES
const int averagedOver = 16; //HOW QUICK NEW VALUES AFFECT RUNNING AVG
const int threshold = 400; //AT WHAT LEVEL LED COMES ON
void setup()
{
pinMode(LedPin, OUTPUT); //
Serial.begin(9600);
}
// put your setup code here, to run once:
void loop()
{
long sumOfSquares = 0;
for (int i = 0; i < numberOfSamples; i++) { //average readings .. .. .. .. ( NORMALLY I is lowercase )
sample = analogRead(micPin); //take a reading
Signal = (sample - middleValue);
Signal *= Signal; //SQUARE IT
sumOfSquares += Signal; //add to the total
}
newReading = sumOfSquares / numberOfSamples;
//caculate running average
runningAverage = (((averagedOver - 1) * runningAverage) + newReading) / averagedOver;
Serial.print("new:"); Serial.print(newReading);
Serial.print(".");
Serial.print("running:");
Serial.println(runningAverage);
if (runningAverage > threshold) { //is average more than threshold?
digitalWrite(LedPin, HIGH);
} else {
digitalWrite(LedPin, LOW);
}
}
Also notice MM's code – it's color coded, as it will be in the Arduino editor. Command words show up as light blue. If a command doesn't show up that way, you have a typo.