Skip to content

Instantly share code, notes, and snippets.

@elktros
elktros / blinkingLED.asm
Last active March 2, 2025 04:20
8051 Microcontroller Assembly Language Program for Blinking LEDs
ORG 00H ; Assembly Starts from 0000H.
; Main Program
START: MOV P1, #0XFF ; Move 11111111 to PORT1.
CALL WAIT ; Call WAIT
MOV A, P1 ; Move P1 value to ACC
CPL A ; Complement ACC
MOV P1, A ; Move ACC value to P1
CALL WAIT ; Call WAIT
SJMP START ; Jump to START
WAIT: MOV R2, #10 ; Load Register R2 with 10 (0x0A)
@elktros
elktros / Raspberry-Pi-Pico-USB-CMakeLists.txt
Created March 22, 2021 12:56
Raspberry Pi Pico USB Serial CMakeLists
if (TARGET tinyusb_device)
add_executable(hello_usb
hello_usb.c
)
# Pull in our pico_stdlib which aggregates commonly used features
target_link_libraries(hello_usb pico_stdlib)
# enable usb output, disable uart output
pico_enable_stdio_usb(hello_usb 1)
@elktros
elktros / ESP8266-I2C-LCD-Demo.ino
Created February 24, 2021 16:04
Display text on I2C LCD using ESP8266 NodeMCU.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 16, 2);
void setup()
{
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
@elktros
elktros / Raspberry_Pi_TCS3200_Color_Detector.py
Created February 12, 2018 11:36
Python Script for Raspberry Pi based Color Detector using TCS3200 Color Sensor.
import RPi.GPIO as GPIO
import time
s2 = 23
s3 = 24
signal = 25
NUM_CYCLES = 10
@elktros
elktros / ESP8266-NodeMCU-OLED-Text.ino
Created February 26, 2021 07:47
Display text on OLED using ESP8266 NodeMCU.
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_MOSI 13
#define OLED_CLK 14
@elktros
elktros / Arduino_Water_Flow_Sensor.ino
Created June 18, 2018 10:48
Code for interfacing YF-S201 Water Flow Sensor with Arduino UNO.
const int watermeterPin = 2;
volatile int pulse_frequency;
unsigned int literperhour;
unsigned long currentTime, loopTime;
byte sensorInterrupt = 0;
void setup()
{
pinMode(watermeterPin, INPUT);
@elktros
elktros / 8051_7_Segment_Interface_4_Digit.c
Last active May 2, 2024 11:27
Code for interfacing 4-digit 7-segment display with 8051 Microcontroller. The display type is Common Anode.
#include<reg51.h>
#define led P0
sbit sw1=P2^0;
sbit sw2=P2^1;
sbit sw3=P2^2;
sbit sw4=P2^3;
unsigned char ch[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
//void delay (int);
void display (unsigned long int);
void sdelay (char);
@elktros
elktros / ISD1820_Voice_Recorder_Arduino.ino
Created December 26, 2018 10:18
Code for Interfacing ISD1820 Voice Recorder Module with Arduino.
int rec=2;
int play=3;
int sensor=4;
int led=13;
void setup()
{
pinMode(rec,OUTPUT);
pinMode(play,OUTPUT);
pinMode(led,OUTPUT);
@elktros
elktros / Arduino_Interrupts_Button_Interrupt_Debounce.ino
Created June 29, 2018 08:04
Interrupt based Button sketch with debounce for Arduino Interrupts Tutorial.
int ledPin = 13;
int buttonPin = 2;
int ledToggle;
int previousState = HIGH;
unsigned int previousPress;
volatile int buttonFlag;
int buttonDebounce = 20;
void setup()
@elktros
elktros / Digital_Voltmeter_using_8051_VoltageSensor_ADC0804.c
Created November 14, 2018 04:29
Code for Digital Voltmeter using 8051 Microcontroller, Voltage Sensor and ADC0804.
#include<reg51.h>
#define lcd P3
#define dat P2
sbit rs=P1^6;
sbit e=P1^7;
void delay (int);
void display (unsigned char);
void cmd (unsigned char);