Skip to content

Instantly share code, notes, and snippets.

@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};
@Ajak58a
Ajak58a / Unidirectional-Receive.ino
Created August 5, 2024 16:03
Communicating over ESP32 NOW
#include <esp_now.h>
#include <WiFi.h>
typedef struct struct_message {
char a[32];
int b;
float c;
bool d;
} struct_message;
@Ajak58a
Ajak58a / code.ino
Created July 26, 2024 11:32
Dustbin with Arduino
#include <Servo.h> //servo library
Servo servo;
int trigPin = 5;
int echoPin = 6;
int servoPin = 7;
int led= 10;
long duration, dist, average;
long aver[3]; //array for average
@Ajak58a
Ajak58a / hc12_Rx_servo.ino
Created July 9, 2024 19:21
Receiver Program
#include <SoftwareSerial.h>
#include <Servo.h>
#define led 13
SoftwareSerial HC12(2,3);
Servo motor1,motor2;
char recv_ch;
int angl1=90,angl2=90;
void setup()
{
HC12.begin(9600);
@Ajak58a
Ajak58a / joystick_HC12_tx_ATtiny.ino
Created July 9, 2024 19:19
Transmitter Program
#include <SoftwareSerial.h>
#define led 0
SoftwareSerial HC12(1,2);
void blink_led()
{
digitalWrite(led,HIGH);
delay(250);
digitalWrite(led,LOW);
}
void setup()
@Ajak58a
Ajak58a / ESP32-Cloud-LED.ino
Created July 9, 2024 19:12
ESP 32 CLoud LED
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/8b59cc8e-df69-4ca9-bb48-0eef1751e497
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
CloudLight lED;
@Ajak58a
Ajak58a / joystick_HC12_tx_ATtiny.ino
Created June 19, 2024 16:09
Joystick controlled dc motor
#include <SoftwareSerial.h>
#define led 0
SoftwareSerial HC12(1,2);
void blink_led()
{
digitalWrite(led,HIGH);
delay(250);
digitalWrite(led,LOW);
}
void setup()
@Ajak58a
Ajak58a / MP3-TF-16P-Arduino.ino
Created June 10, 2024 20:38
MP3 Audio Files
void sendDFCommand(byte Command, int ParData) {
byte commandData[10];
byte q;
int checkSum;
commandData[0] = 0x7E; //Start of new command
commandData[1] = 0xFF; //Version information
commandData[2] = 0x06; //Data length (not including parity) or the start and version
commandData[3] = Command; //The command that was sent through
commandData[4] = 0x01; //1 = feedback
commandData[5] = highByte(ParData); //High byte of the data sent over
@Ajak58a
Ajak58a / HX711 digital scale.ino
Created June 3, 2024 16:42
Digital Weighing Scale
#include "HX711.h"
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Pushbutton.h>
const int HX711_DOUT = 2;
const int HX711_SCK = 3;
HX711 scale;