Compiler can't find library files

Working my way through some tutorials. Got to ELEGOO Lessons 9, and 10 and ran into a problem. Each of these lessons starts off looking for a .h file in a library. I can see the .h files in the library, but the compiler evidently does not.

Servo Lesson 9: servo.h
Lesson 10: SR04.h

Error message for Lesson 10:

Arduino: 1.8.10 (Windows 7), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

SR04_Example:3:10: error: SR04.h: No such file or directory

#include "SR04.h"

^~~~~~~~

compilation terminated.

exit status 1
SR04.h: No such file or directory

Invalid library found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink: no headers files (.h) found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink
Invalid library found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink: no headers files (.h) found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Library that contains SR04.h is not installed or is installed incorrectly.

I'm not sure where the library should be installed.

I've followed the tutorial instructions.

I currently have it C:\Program Files (x86)\Arduino\libraries\HC-SR04.zip\HC-SR04

(deleted)

C:\Program Files (x86)\Arduino\libraries\HC-SR04.zip\HC-SR04

HC-SR04 contains the unzipped files (.h, .cpp, etc.)

I've been at this for hours with no success.

So, I got the path to look like this:

C:\Program Files (x86)\Arduino\libraries\HC-SR04

and it still can't find it.

Here's the error message:

Arduino: 1.8.10 (Windows 7), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\Brantley Buerger\Documents\Arduino\libraries\HCSR04_Example\HCSR04_Example.ino: In function 'void loop()':

HCSR04_Example:13:6: error: 'hcsr04' was not declared in this scope

a=hcsr04.Distance();

^~~~~~

C:\Users\Brantley Buerger\Documents\Arduino\libraries\HCSR04_Example\HCSR04_Example.ino:13:6: note: suggested alternative: 'sr04'

a=hcsr04.Distance();

^~~~~~

sr04

Multiple libraries were found for "HCSR04.h"
Used: C:\Users\Brantley
exit status 1
'hcsr04' was not declared in this scope

Invalid library found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\HCSR04_Example: no headers files (.h) found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\HCSR04_Example
Invalid library found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink: no headers files (.h) found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink
Invalid library found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\HCSR04_Example: no headers files (.h) found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\HCSR04_Example
Invalid library found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink: no headers files (.h) found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

(deleted)

(deleted)

(deleted)

Some.

The program has now found the SR04.h file, and uploads, but now only reads a constant 0 cm distance.

Thanks for your help.

(deleted)

Note that this is for Lesson 9 (Servo)

Picture attached.

Code:

//www.elegoo.com
//2018.12.19
#include <Servo.h>
Servo myservo;

void setup(){
myservo.attach(12);
myservo.write(90);// move servos to center position -> 90°
}
void loop(){
myservo.write(90);// move servos to center position -> 90°
delay(500);
myservo.write(30);// move servos to center position -> 60°
delay(500);
myservo.write(90);// move servos to center position -> 90°
delay(500);
myservo.write(150);// move servos to center position -> 120°
delay(500);
}

Lesson 10: Ultrasonic sensor. Uploads properly, I think, but only reads out 0 cm in the serial monitor.

Code:

//www.elegoo.com
//2016.12.08
#include "SR04.h"
#define TRIG_PIN 2
#define ECHO_PIN 4
SR04 sr04 = SR04(ECHO_PIN,TRIG_PIN);
long a;

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

void loop() {
a=sr04.Distance();
Serial.print(a);
Serial.println("cm");
delay(1000);
}

Picture attached.

Trouble with tutorial (ELEG00) Lesson 11 (and it looks so simple!!)

Sketch uploads OK, but no output provided in the serial monitor when I press the keys on the keypad.

Picture attached.

BTW, what are code tags, how are they used, and should I be using them?

Code:

//www.elegoo.com
//2016.12.9

/* @file CustomKeypad.pde
|| @version 1.0
|| @author Alexander Brevig
|| @contact alexanderbrevig@gmail.com
||
|| @description
|| | Demonstrates changing the keypad size and key values.
|| #
*/
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {12,14,27,26}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {25,23,32,35}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

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

void loop(){
char customKey = customKeypad.getKey();

if (customKey){
Serial.println(customKey);
}
}

Resize your pictures; 2MByte is to much for people with limited bandwidth, 200 kBytes is more acceptable.

These are code tags

[code]your code here[/code]

(deleted)

Now, for some reason Lesson 11 is no longer uploading. Error statement:

Arduino: 1.8.10 (Windows 7), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Sketch uses 3696 bytes (1%) of program storage space. Maximum is 253952 bytes.
Global variables use 333 bytes (4%) of dynamic memory, leaving 7859 bytes for local variables. Maximum is 8192 bytes.
An error occurred while uploading the sketch
avrdude: ser_open(): can't open device "\.\COM7": The system cannot find the file specified.

avrdude: ser_drain(): read error: The handle is invalid.

avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
Invalid library found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\HCSR04_Example: no headers files (.h) found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\HCSR04_Example
Invalid library found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink: no headers files (.h) found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink
Invalid library found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\HCSR04_Example: no headers files (.h) found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\HCSR04_Example
Invalid library found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink: no headers files (.h) found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Now, Lesson 10 is no longer uploading.

Error statement:

Arduino: 1.8.10 (Windows 7), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Sketch uses 3414 bytes (1%) of program storage space. Maximum is 253952 bytes.
Global variables use 207 bytes (2%) of dynamic memory, leaving 7985 bytes for local variables. Maximum is 8192 bytes.
An error occurred while uploading the sketch
avrdude: ser_open(): can't open device "\.\COM7": The system cannot find the file specified.

avrdude: ser_drain(): read error: The handle is invalid.

avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
Invalid library found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\HCSR04_Example: no headers files (.h) found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\HCSR04_Example
Invalid library found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink: no headers files (.h) found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink
Invalid library found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\HCSR04_Example: no headers files (.h) found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\HCSR04_Example
Invalid library found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink: no headers files (.h) found in C:\Users\Brantley Buerger\Documents\Arduino\libraries\My_Blink

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Thanks to spycatcher for noting that the tutorial pictures did not match the code in Lesson 10.

I was using the wrong pins for the following:

#define TRIG_PIN 2
#define ECHO_PIN 4 12 and

Now everything works. Thanks.

(I'm more than a little upset that the tutorial didn't match the code!!!!!)

OK, not sure why, but Lesson 11 is uploading correctly, but still no output to the serial monitor from the keypad.

Wondering if I have another pin error, but the pin locations are evidently in the keypad.h file which I am unable to open. How can I check this? Or is there something else wrong?