Skip to content

Instantly share code, notes, and snippets.

View dahmadjid's full-sized avatar

Dahmani Abdelmadjid dahmadjid

View GitHub Profile
template<typename T>
concept Hittable = requires (T& t, const Vec3<float>& position, const Ray& ray){
{ t.position() } -> std::same_as<Vec3<float>>;
{ t.set_position(position) } -> std::same_as<void>;
{ t.hit(ray) } -> std::same_as<HitPayload>;
};
template<Hittable...Ts>
class HittableList {
@dahmadjid
dahmadjid / mpu.ino
Created December 11, 2022 12:14
mpu6050
// Basic demo for accelerometer readings from Adafruit MPU6050
// ESP32 Guide: https://RandomNerdTutorials.com/esp32-mpu-6050-accelerometer-gyroscope-arduino/
// ESP8266 Guide: https://RandomNerdTutorials.com/esp8266-nodemcu-mpu-6050-accelerometer-gyroscope-arduino/
// Arduino Guide: https://RandomNerdTutorials.com/arduino-mpu-6050-accelerometer-gyroscope/
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
import socket
server_address = ("localhost",6205) # The address of the server. its "" because we are in the same machine
client_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) # same as server
client_socket.connect(server_address) # we initialise the connection. this will not finish excuting until the server accepts.
message = b'hello from client' # same as server
client_socket.send(message) # same as server
data = client_socket.recv(1024).decode("utf-8") # same as server
print(data)
/**
* @brief MPU6050 constructor.
*/
void mpu6050_init();
/**
* @brief: Get digital low-pass filter configuration. The DLPF_CFG parameter
* sets the digital low pass filter configuration. It also determines the
// RSLB
#include <Arduino.h>
int trig1 = A3; // FRONT SENSOR
int echo1 = A2;
int trig2 = A1; // LEFT SENSOR 1 0
int echo2 = A0;
@dahmadjid
dahmadjid / main.cpp
Created January 24, 2022 22:02
spi slave
#include <iostream>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "driver/spi_slave.h"
#include "esp_log.h"