This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PPG Demo by Andy Kong | |
// FFT function in Javascript | |
// - Make sure to include the fft.js in a <script> tag in the HTML header. | |
// - We initialize the FFT object in Javascript using this command in the main | |
// fft = new window.kiss.FFTR(maxHistLen); | |
async function calcFFT(data){ | |
// Remove offset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Face Mesh Demo by Andy Kong</title> | |
<!-- Import latest version of TF.js--> | |
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script> | |
<!-- Facemesh model import --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Must be run in console to work properly | |
import numpy as np | |
import cv2 | |
import time | |
from scipy import signal | |
import matplotlib.pyplot as plt | |
import matplotlib | |
import threading | |
import scipy.signal as sig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define LED_pin 9 | |
// Track LED state | |
bool LED_state = false; | |
// Set frequency of LED | |
float blinkrate = 1; // In Hz | |
float delay_between_switch = 500.0/blinkrate; // Blink at N Hz means you switch every 1s/(N/2) | |
// Track blinking cycle times of LED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var px = 50; // Position x and y | |
var py = 50; | |
var vx = 0.0; // Velocity x and y | |
var vy = 0.0; | |
var updateRate = 1/60; // Sensor refresh rate | |
function getAccel(){ | |
DeviceMotionEvent.requestPermission().then(response => { | |
if (response == 'granted') { | |
// Add a listener to get smartphone orientation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Accelerometer Demo</title> | |
<style> | |
.indicatorDot{ | |
width: 30px; | |
height: 30px; |
NewerOlder