Skip to content

Instantly share code, notes, and snippets.

View fuzzygreenblurs's full-sized avatar

Akhil Sankar fuzzygreenblurs

  • New York
View GitHub Profile
@fuzzygreenblurs
fuzzygreenblurs / debouncer_tb.vhd
Created February 21, 2024 18:45
debouncer tb
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity debouncer_tb is
end debouncer_tb;
architecture tb_arch of debouncer_tb is
signal tb_clk : std_logic := '0';
signal tb_dbnc : std_logic;
signal tb_btn : std_logic := '0';
@fuzzygreenblurs
fuzzygreenblurs / mqtt.md
Created January 1, 2024 19:07
Simple MQTT Broker & Client

Motivation

WARNING: the entirity of this implementation is for development purposes only and has not been tested for production systems. it is purely meant as a guideline to document some basic research findings and should NOT be used as-is for any real-world applications.

This is a basic implementation of a Mosquitto based MQTT pipeline. MQTT is a lightweight M2M protocol designed with IoT applications in mind. For example, if we want to read the state of an assembly line and trigger changes to the system, we might use an MQTT based pipeline to do this.

What can we do with an MQTT based broker/client approach:

  1. scalability: we might have several thousand sensors and actuators across our line that need to communicate with our central server cluster
  2. quality of service: depending on importance, we want the flexibility of a fire-and-forget, an atleast-once or even an exactly-once guarantee of message delivery
#!/usr/bin/ruby
require 'xmlrpc/client'
elevator = XMLRPC::Client.new2('http://localhost:8000')
elevator.call :reset
floor_requests = []
CURRENT_FLOOR = 1
COMPLETED = true