Skip to content

Instantly share code, notes, and snippets.

View barbarbar338's full-sized avatar
☢️
works on my machine

Barış DEMİRCİ barbarbar338

☢️
works on my machine
View GitHub Profile
@barbarbar338
barbarbar338 / jkflop.vhdl
Created April 29, 2025 19:06
JK-flip-flop code for Basys3
-- barbarbar338
library ieee;
use ieee.std_logic_1164.all;
entity jk_flip_flop is
port (
clk : in std_logic;
j : in std_logic;
k : in std_logic;
q : out std_logic;
@barbarbar338
barbarbar338 / basys3.xdc
Last active April 28, 2025 20:41
3-bit up counter for Basys3 using d-flip-flops - Full
## https://github.com/Digilent/digilent-xdc/blob/master/Basys-3-Master.xdc
## Clock signal
set_property -dict { PACKAGE_PIN W5 IOSTANDARD LVCMOS33 } [get_ports clk_in]
create_clock -add -name sys_clk_pin -period 10.00 -waveform {0 5} [get_ports clk_in]
## LEDs
set_property -dict { PACKAGE_PIN U16 IOSTANDARD LVCMOS33 } [get_ports {count[0]}]
set_property -dict { PACKAGE_PIN E19 IOSTANDARD LVCMOS33 } [get_ports {count[1]}]
set_property -dict { PACKAGE_PIN U19 IOSTANDARD LVCMOS33 } [get_ports {count[2]}]
@barbarbar338
barbarbar338 / 3-bit-counter.vhdl
Last active April 28, 2025 20:08
3-bit up counter for basys3
-- barbarbar338
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity main_counter is
Port (
clk_in : in std_logic; -- Basys3 100MHz clock
reset : in std_logic;
clk_out : out std_logic;
count : out std_logic_vector(2 downto 0) -- 3-bit counter
@barbarbar338
barbarbar338 / dff.vhdl
Last active April 28, 2025 20:08
D-flip-flop for Basys3 with reset - Positive-edge triggered
-- barbarbar338
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity dff is
Port (
clk : in std_logic;
reset : in std_logic;
d : in std_logic;
q : out std_logic
@barbarbar338
barbarbar338 / clock_divider.vhdl
Last active April 28, 2025 20:08
Clock divider for Basys3 - 100MegHz to 2Hz
-- barbarbar338
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity freq_divider is
Port (
clk_in : in std_logic; -- 100MHz clock input
reset : in std_logic;
clk_out : out std_logic -- 2Hz clock output
@barbarbar338
barbarbar338 / pendulum.cpp
Created April 12, 2025 10:26
Shows information about an ideal pendulum - Prepared for AGU EEE Coma Capsule Integrated Project#3
#include <iostream>
#include <cmath>
using namespace std;
const double pi = acos(0) * 2;
class Pendulum {
private:
double length;
@barbarbar338
barbarbar338 / student_grade_check.cpp
Created April 12, 2025 10:03
Checking how many questions students answered from a CSV table - Prepared for AGU EEE Coma Capsule Integrated Project#2
#include <iostream>
#include <vector>
#include <fstream>
#include <sstream>
#include <map>
#include <algorithm>
using namespace std;
// Using pointers to pass the vector by reference
@barbarbar338
barbarbar338 / inverse.cpp
Last active April 20, 2025 13:16
Taking the Inverse of a Matrix Using Gauss-Jordan Method - Prepared for AGU EEE Coma Capsule Integrated Project#1
#include <iostream>
/*
used vectors instead of arrays.
It's easier to work with vectors
because of their dynamic size.
~ barbarbar338
*/
#include <vector>
@barbarbar338
barbarbar338 / plotter.ino
Last active February 22, 2025 19:27
Arduino UNO code used in AGU Digital System Design Capsule Project to plot clock output and calculate frequency
/*
You might need to change the plotter
history size to see everything cleaner.
Here is a good tutorial for this:
https://youtu.be/qrfpPuw2W3A
*/
const int analogPin = A0; // Clock output pin
const int threshold = 512; // Midpoint (~2.5V for a 5V signal)
@barbarbar338
barbarbar338 / LaTeX-on-Android.md
Created January 1, 2024 15:47
Compile LaTeX files on Android

Compile LaTeX files on Android

  • Install Termux from F-Droid. This part is important, not from Google Play Store. GPlay restricts some functionality of Termux.
  • Upgrade dependencies: pkg update && pkg upgrade
  • To access device storage, run this command. It's needed to access created LaTeX and PDF files: termux-setup-storage
  • cd into local storage: cd ~/storage/shared
  • Create LaTeX project folder. We'll save our files here and access them from this folder from our device: mkdir LaTeX
  • Install TeX Live installer: pkg install texlive-installer
  • Install TeX Live. Important note, do not change any option here: termux-install-tl
  • Create bash config file with these configurations: nvim ~/.bashrc