The piezo and my microcontroller board.

Piezo Input

Researching fab academy students´s pages I saw Shunichi Mizugaki page that help me to see the input assignment with piezo. The Academy input Piezo we can detect vibration or a knock.

Piezo Input

Coding

From Arduino example IDE "knock" is possible to code to recieve the Piezo input data. I modified the "knock" example in order to work with my microcontroller board Attiny44 from my week 10.

/* created 25 Mar 2007
by David Cuartielles
modified 30 Aug 2011
by Tom Igoe
Adapted by Alex Garcia Oct 2017 to Attiny44
This example code is in the public domain.
 */
 #include 
SoftwareSerial mySerial(0,1); // RX, TX
const int knockSensor = A4; // the piezo is connected to analog pin 4
// these variables will change:
int sensorReading = 0;      // variable to store the value read from the sensor pin
void setup() {
mySerial.begin(9600);       // use the serial port
}
void loop() {
// read the sensor and store it in the variable sensorReading:
sensorReading = analogRead(knockSensor);
 mySerial.println(sensorReading);
delay(100);  // delay to avoid overloading the serial port buffer
}

Uploading the piezo code to my board

The result

Input Fab Academy 2017 from Alex Angelo on Vimeo.