Page 138 - Programming the Photon Getting Started With the Internet of Things
P. 138
diagram for this experiment can be shown in Figure 6.14.
Figure 6.14 Breadboard layout diagram.
Let’s take a look at the program code that we will use on our Photon board:
#include "HC_SR04/HC_SR04.h"
double cm = 0.0;
double inches = 0.0;
int trigPin = D4;
int echoPin = D5;
HC_SR04 rangefinder = HC_SR04(trigPin, echoPin);