#include <ABLocks_TimerFreeTone.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled_1(128,64, &Wire,-1);
bool oled_1_autoshow=true;
void setup()
{
pinMode(4, INPUT);
pinMode(25, OUTPUT);
pinMode(32, OUTPUT);
pinMode(33, OUTPUT);
pinMode(26, OUTPUT);
oled_1.begin(SSD1306_SWITCHCAPVCC,0x3C);
oled_1.clearDisplay();
if(oled_1_autoshow)oled_1.display();
oled_1.setTextSize(1);
oled_1.setTextColor(WHITE);
oled_1.setCursor(0,0);
oled_1.print(String("Semáforo Peatonal"));
if(oled_1_autoshow)oled_1.display();
oled_1.setTextSize(1);
oled_1.setTextColor(WHITE);
oled_1.setCursor(0,30);
oled_1.print(String("con alarma"));
if(oled_1_autoshow)oled_1.display();
oled_1.display();
}
void loop()
{
yield();
while(!((!digitalRead(4))));
digitalWrite(25, LOW);
digitalWrite(32, HIGH);
digitalWrite(33, LOW);
delay(2000);
for (int count = 0; count < 3; count++) {
digitalWrite(25, LOW);
digitalWrite(32, LOW);
digitalWrite(33, HIGH);
TimerFreeTone(26,1000,500);
delay(200);
digitalWrite(25, LOW);
digitalWrite(32, LOW);
digitalWrite(33, LOW);
TimerFreeTone(26,500,500);
delay(200);
}
digitalWrite(25, HIGH);
digitalWrite(32, LOW);
digitalWrite(33, LOW);
}