worldfamouselectronics / raspberry_pi Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
I and @akelley want to use this library for the Pico and are developing in Micropython. We have been able to get the sensor to return analog values but are having trouble choosing a good threshold value for a heartbeat. When scaling the threshold value (accounting for the 10bit to 12bit ADC difference) from one of your example programs we wind up with BPM that is significantly higher than expected. Any advice on threshold values or help translating some of the functions in this library would help a lot. Our micropython script is below.
import machine
import utime
from machine import Pin, Timer
sensor_BPM = machine.ADC(28)
conversion_factor = 3.3/65535
thresh = 37200
pin = Pin("LED",Pin.OUT)
holdstate = False
beats = 0
timer=Timer(-1) #virtual timer, the ID will be -1
def interuptHandle(timer):
#global holdstate
#holdstate = True
global beats
print('flag toggle')
print('interupting, BPM is: ', (beats*10))
utime.sleep(1)
beats = 0
timer.init(period=6000, mode=Timer.PERIODIC, callback=interuptHandle)
while True:
if holdstate != True:
reading = sensor_BPM.read_u16()
if reading > thresh:
pin.high()
beats += 1
utime.sleep_ms(100)
else:
pin.low()
print("Voltage: ", reading)
utime.sleep_ms(100)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.