Skip to content

Instantly share code, notes, and snippets.

View Dhritish-Mukherjee's full-sized avatar

Dhritish Mukherjee Dhritish-Mukherjee

  • Kolkata, West Bengal
  • 20:41 (UTC -12:00)
View GitHub Profile
import socket
import json
# SAME RASPBERRY PI TESTING
SERVER_IP = "127.0.0.1"
# For another Raspberry Pi:
# SERVER_IP = "192.168.x.x"
PORT = 5000
import socket
import time
import json
import board
import adafruit_dht
# -----------------------------
# DHT SENSOR SETUP
# -----------------------------
import socket
SERVER_IP = '192.168.1.10' # Replace with your server IP
PORT = 5000
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect((SERVER_IP, PORT))
print("Connected to server")
import socket
import Adafruit_DHT
import time
# Sensor setup
sensor = Adafruit_DHT.DHT11
pin = 4
# Server setup
HOST = '0.0.0.0'
import Adafruit_DHT
sensor = Adafruit_DHT.DHT11
pin = 4
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
if humidity is not None and temperature is not None:
print(f"Temperature: {temperature}°C")
print(f"Humidity: {humidity}%")
class Shape {
void display() {
System.out.println("Shape Class");
}
}
class Parallelepiped extends Shape {
double l, b, h;
Parallelepiped(double l, double b, double h) {
class Shape {
// Volume methods
double volume(double l, double b, double h) {
return l * b * h; // Parallelepiped
}
double volume(double r) {
return (4.0 / 3.0) * Math.PI * r * r * r; // Sphere
}
class Vehicle{
protected String licence_number;
protected int speed;
protected String color;
protected String owner_name;
Vehicle(String licence_number, int speed, String color, String owner_name){
this.licence_number = licence_number;
this.speed = speed;
this.color = color;