Skip to content

Instantly share code, notes, and snippets.

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
const int trigPin = 5;
const int echoPin = 18; //define sound speed in cm/uS
#define SOUND_SPEED 0.034
@Ajak58a
Ajak58a / arduini_rfid_oled_tol.ino
Created January 15, 2025 13:18
How to create an RFID-based locker system using Arduino
#include <splash.h>
#include <MFRC522.h>
#include <MFRC522Extended.h>
#include <deprecated.h>
#include <require_cpp11.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Servo.h> // Include the Servo library
@Ajak58a
Ajak58a / Traffic-Lights-Arduino.ino
Created January 15, 2025 13:13
Traffic Lights Arduino
#include <SPI.h>
int SPI_MOSI = 12;
int SPI_CLK = 11;
int SPI_CS = 10;
byte spidata[16];
int a = 20;
int b = 20;
int c = 20;
int d = 20;
@Ajak58a
Ajak58a / Traffic-Lights-Arduino.ino
Created January 7, 2025 13:55
Traffic-Lights-Arduino
#include <SPI.h>
int SPI_MOSI = 12;
int SPI_CLK = 11;
int SPI_CS = 10;
byte spidata[16];
int a = 20;
int b = 20;
int c = 20;
int d = 20;
#include <TinyGPSPlus.h>
TinyGPSPlus gps;
float lat, lng;
float latrad, lngrad;
float inilat = 0; //SET THIS TO LATITUDE IN DEGREES OF YOUR DESIRED GPS LOCATION
float inilng = 0; //SET THIS TO LONGITUDE IN DEGREES OF YOUR DESIRED GPS LOCATION
float inilatrad, inilngrad;
float diflat=0;
float diflng=0;
float calc1=0;
@Ajak58a
Ajak58a / Chakra-Meditation-Device.ino
Created December 2, 2024 17:05
Chakra meditation devices
const int PIN_RED = A0;
const int PIN_GREEN = A1;
const int PIN_BLUE = A2;
int buttonPause = 2;
int buttonNext = 3;
int buttonRepeat = 4;
int tracknum;
boolean isPlaying = false;
boolean Repeat = false;
// Pin definitions
const int eyeBlinkSensorPin = 10; // Eye blink sensor connected to digital pin 10
const int buzzerPin = 13; // Buzzer connected to digital pin 13
const int motorControlPin = 7; // Relay control for motor connected to digital pin 7
const int testSwitchPin = 4; // Test switch connected to digital pin 4
const int resetSwitchPin = 5; // Reset switch connected to digital pin 5
bool drowsinessDetected = false;
void setup() {
@Ajak58a
Ajak58a / Final code.ino
Created October 29, 2024 15:30
Smart clock measures temp humidity ESP8266
#include <ESPAsyncUDP.h>
#include <NTPClient.h>
#include <TimeLib.h>
#include <DHT.h>
#include <DHT_U.h>
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <Adafruit_GFX.h>
#include <WiFiUdp.h>
#include <Adafruit_ST7735.h>
@Ajak58a
Ajak58a / Broadcast.ino
Created August 5, 2024 16:06
Communicating over ESP NOW
#include <WiFi.h>
#include <esp_now.h>
bool buttonDown = false;
bool ledOn = false;
#define STATUS_LED 23
#define STATUS_BUTTON 22
void formatMacAddress(const uint8_t *macAddr, char *buffer, int maxLength)
@Ajak58a
Ajak58a / Unidirectional-Send.ino
Created August 5, 2024 16:04
Communicating over ESP NOW
#include <esp_now.h>
#include <WiFi.h>
int int_value;
float float_value;
bool bool_value = true;
//Receiver MAC Address
uint8_t broadcastAddress[] = {0x0c, 0xB8, 0x15, 0xCA, 0xE2, 0xD8};