Skip to content

Instantly share code, notes, and snippets.

View mkhorasani's full-sized avatar

Mohammad Khorasani mkhorasani

View GitHub Profile
import serial
import serial
import streamlit as st
import plotly.graph_objects as go
import time
arduino = serial.Serial(port='COM5', baudrate=9600, parity=serial.PARITY_NONE,stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS) #Change COM3 to whichever COM port your arduino is in
st.sidebar.title('Radar')
info_bar = st.empty()
#include <Servo.h>
Servo myservo;
int val = 0; // variable to store the sensor value
int analogPin = A0; // sensor pin
String pval = "*"; // string variable to send sensor value over COM port
void setup() {
Serial.begin(9600); // setup serial communication
myservo.attach(3); // attach motor to PWM pin 3
myservo.write(90); // rotating motor to initial position
def chart(df):
df_columns = list(df)
df['DateTime'] = pd.to_datetime(df['DateTime'],format='%d-%m-%y %H:%M')
df['DateTime'] = df['DateTime'].dt.strftime(' %H:%M on %B %-d, %Y')
df = df.sort_values(by='DateTime')
fig = px.line(df, x="DateTime", y=df_columns,
labels={
"DateTime": "DateTime",
"value": "Value",
import serial
import time
import streamlit as st
import plotly.graph_objects as go
import plotly.express as px
from datetime import datetime
import pandas as pd
arduino = serial.Serial(port='COM5', baudrate=9600, parity=serial.PARITY_NONE,stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS) #Change the COM port to whichever port your arduino is in
gauge_placeholder = st.empty()
#include <Wire.h>
#include <Adafruit_MLX90614.h>
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
void setup() {
Serial.begin(9600);
mlx.begin();
}
void loop() {
def donut_chart(value):
if value >= 80:
color = [0.4392,0.6784,0.2784]
if (value < 80) and (value >= 60):
color = [0.9569,0.6941,0.5137]
if value < 60:
color = [1.0000,0.4118,0.4118]
my_circle=plt.Circle( (0,0), 0.8, color=[0.4902,0.8000,1.0000])
def bar_chart(credit, debit, balance):
x = [x[0:6] for (x,y) in balance]
y1 = [y for (x,y) in credit]
y2 = [y for (x,y) in debit]
y3 = [y for (x,y) in balance]
n = len(x)
index = np.arange(n)
import openpyxl as xl
from openpyxl.chart import LineChart, Reference
import win32com.client
import PIL
from PIL import ImageGrab, Image
import os
import sys
from docx.shared import Cm
//Sleep function
const sleep = (milliseconds) => {
return new Promise(resolve => setTimeout(resolve, milliseconds))
}
//Initiating iteration
var iteration = 0;
//Main function
const main = async () => {
//Creating log to store error/warning messages
var logOfConsole = [];
var _log = console.log,
_warn = console.warn,//new
_error = console.error;//new
//Logging errors function
console.error = function() {
logOfConsole.push({method: 'error', arguments: 'Arguments ["No output window available", callee: ƒ, Symbol(Symbol.iterator): ƒ]'});