File tree 1 file changed +29
-0
lines changed
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * This script checks whether the arduino board is able to capture the voltage signals generated by the piezos
3
+ *
4
+ * By:
5
+ * Jash Bharat Mota
6
+
7
+ * http://www.jashmota.esy.es
8
+ */
9
+
10
+ // these constants won't change:
11
+ const int knockSensor = A1; // the piezo is connected to analog pin 0
12
+
13
+
14
+ // these variables will change:
15
+ int sensorReading = 0 ; // variable to store the value read from the sensor pin
16
+
17
+ void setup () {
18
+ Serial.begin (9600 ); // use the serial port
19
+ }
20
+
21
+ void loop () {
22
+ // read the sensor and store it in the variable sensorReading:
23
+ sensorReading = analogRead (knockSensor);
24
+
25
+ delay (200 ); // delay to avoid overloading the serial port buffer
26
+ Serial.print (" Voltage: " );
27
+ Serial.println (sensorReading);
28
+ }
29
+
You can’t perform that action at this time.
0 commit comments