#define sensorPIR 13
int leituraSensor = 0;
int contagem = 0;
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
void setup() {
Serial.begin(9600);
pinMode(sensorPIR, INPUT);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
oled.clearDisplay();
oled.setTextColor(WHITE);
}
void loop() {
leituraSensor = digitalRead(sensorPIR);
if(leituraSensor == HIGH) {
contagem = contagem + 1;
oled.setCursor(0,0);
oled.setTextSize(2);
oled.print("Pessoas");
oled.setCursor(64,32);
oled.setTextSize(2);
oled.print(contagem);
oled.display();
delay(5000);
oled.clearDisplay();
delay(1000);
}
}